diff --git a/commonlibrary/BUILD.gn b/commonlibrary/BUILD.gn index 9c99b6cee575fedf3bf81f8c8d0b2e2a870f0754..29ab23f0dbce2e6b956303a1f13a51b2faa76564 100644 --- a/commonlibrary/BUILD.gn +++ b/commonlibrary/BUILD.gn @@ -16,8 +16,6 @@ group("commonlibrary") { testonly = true if (is_standard_system) { deps = [ - "crossplatform:crossplatform", - "crossplatform/commonlibraryxmletstest:ActsCrossplatformXmlTest", "ets_utils:ets_utils", "toolchain:toolchain", ] diff --git a/commonlibrary/crossplatform/BUILD.gn b/commonlibrary/crossplatform/BUILD.gn deleted file mode 100755 index 1fb136da2915ac0f55bda92f2507daf158a227ba..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/BUILD.gn +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -group("crossplatform") { - testonly = true - if (is_standard_system) { - deps = [ - "commonlibraryArrayListetstest:ActsCrossPlatformArrayListTest", - "commonlibraryLightWeightMapetstest:ActsCrossplatformLightWeightMapTest", - "commonlibraryLightWeightSetetstest:ActsCrossPlatformLightWeightSetTest", - "commonlibraryLinkedListetstest:ActsCrossplatformLinkedListTest", - "commonlibraryListetstest:ActsCrossPlatformList2Test", - "commonlibraryTreeMapetstest:ActsCrossplatformTreeMapTest", - "commonlibraryWorkeretstest:ActsCrossplatformWorkerTest", - "commonlibrarybufferetstest:ActsCrossplatformBufferTest", - "commonlibraryconvertxmletstest:ActsCrossplatformConvertxmlTest", - "commonlibrarydequeetstest:ActsCrossplatformDequeTest", - "commonlibraryhashmapetstest:ActsCrossplatformHashMapTest", - "commonlibraryhashsetetstest:ActsCrossplatformHashSetTest", - "commonlibraryplainarrayetstest:ActsCrossplatformPlainArrayTest", - "commonlibraryprocessetstest:ActsCrossplatformProcessTest", - "commonlibraryqueueetstest:ActsCrossplatformCommonlibraryQueueTest", - "commonlibrarystacketstest:ActsCrossplatformCommonlibraryStackTest", - "commonlibrarytaskpooletstest:ActsCrossplatformCommonlibraryTaskpoolTest", - "commonlibrarytreesetetstest:ActsCrossplatformTreeSetTest", - "commonlibraryurietstest:ActsCrossplatformUriTest", - "commonlibraryurletstest:ActsCrossplatformUrlTest", - "commonlibraryutiletstest:ActsCrossplatformUtilTest", - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/app.json deleted file mode 100755 index 30deb801774265b38794845d4c139d4da1a66244..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.ArrayList.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryArrayListetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryArrayListetstest/BUILD.gn deleted file mode 100755 index 18f0880fb60e0fa4d038dc1d42f35a042235984c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossPlatformArrayListTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossPlatformArrayListTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/Test.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/Test.json deleted file mode 100755 index 0fbd145bc965bbca9bd07516b8b47ab2662ba11c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.ArrayList.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossPlatformArrayListTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryArrayListetstest/signature/openharmony_sx.p7b deleted file mode 100755 index 149759f9c0576334c34eba3eb851803015409659..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryArrayListetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index cb027d69256099790b95a32b446978bbc64b4ecb..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 8cbc4b3b96d8d38bc36fbd9a3173d3fd4f09db73..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/ArrayList.test.ets b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/ArrayList.test.ets deleted file mode 100755 index faa19339e8d22722e36e7570edd7239a10181e39..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/ArrayList.test.ets +++ /dev/null @@ -1,1300 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import ArrayList from "@ohos.util.ArrayList"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function ArraylistTest() { - describe("ArraylistTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an ArrayList instance. For example: let arrayList = new ArrayList(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - try { - let arrayList = new ArrayList(); - expect(arrayList != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The ArrayList's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of elements contained in the ArrayList instance. For example: arrayList.length. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - * */ - it("testLength001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(8, 2); - let res = arrayList.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add a string type element to the end of the ArrayList instance. For example: arrayList.add("四"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - let res = arrayList.has("四"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add a number type element to the end of the ArrayList instance. For example: arrayList.add(8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(8); - let res = arrayList.has(8); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add a object type element to the end of the ArrayList instance. - * For example: let a = {name: "lala", age: "13岁"}; arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let arrayList = new ArrayList(); - let a = {name: "lala", age: "13岁"}; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add a array type element to the end of the ArrayList instance. - * For example: let a = [1, 2, 3, 4]; arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let arrayList = new ArrayList(); - let a = [1, 2, 3, 4]; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add a boolean type element to the end of the ArrayList instance. - * For example: let a = true; arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let arrayList = new ArrayList(); - let a = true; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add a string element to the end of the ArrayList instance. - * For example: for (let i = 0; i < 100; i++) {arrayList.add(i);}. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let arrayList = new ArrayList(); - for (let i = 0; i < 100; i++) { - arrayList.add(i); - } - let res = arrayList.getIndexOf(99); - let res1 = arrayList.length; - expect(res).assertEqual(99); - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add a symbol type element to the end of the ArrayList instance. - * For example: let a = "*";arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let arrayList = new ArrayList(); - let a = "*"; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add a decimal type to the end of the ArrayList instance. For example: let a = "3.14";arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let arrayList = new ArrayList(); - let a = "3.14"; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add a null character element to the end of the ArrayList instance. - * For example: let a = "";arrayList.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let arrayList = new ArrayList(); - let a = ""; - arrayList.add(a); - let res = arrayList.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add a boolean type element to the end of the ArrayList instance. - * For example: arrayList.add.bind({})(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.add.bind({}, "a")() - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_INSERT_001 - * @tc.name : testInsert001 - * @tc.desc : Insert an element into the middle of the ArrayList instance. For example: arrayList.insert(8, 2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(8, 2); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = ["四", "三", 8, 1, "a"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_INSERT_002 - * @tc.name : testInsert002 - * @tc.desc : Inserting an element with an index less than 0 will throw an exception. - * For example: arrayList.insert(8, -1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - try { - let res = arrayList.insert(8, -1); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: -1`); - } - }); - - /** - * @tc.number: TEST_INSERT_003 - * @tc.name : testInsert003 - * @tc.desc : Inserting an element with an index greater than or equal to the length of - * the ArrayList instance will throw an exception. For example: arrayList.insert(8, 10). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - try { - let res = arrayList.insert(8, 10); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 10`); - } - }); - - /** - * @tc.number: TEST_INSERT_004 - * @tc.name : testInsert004 - * @tc.desc : Inserting an element with an index greater than or equal to the length of - * the ArrayList instance will throw an exception. For example: arrayList.insert(8, 11). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert004", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - try { - let res = arrayList.insert(8, 11); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 11`); - } - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Check whether the ArrayList contains a specified element. For example: arrayList.has(8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(8, 2); - let res = arrayList.has(8); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_002 - * @tc.name : testHas002 - * @tc.desc : Check whether the ArrayList contains a specified element. - * For example: arrayList.has.bind({})(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testHas002', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.has.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The has method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_HAS_003 - * @tc.name : testHas003 - * @tc.desc : Check whether the ArrayList contains a specified element. For example: arrayList.has("二"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(8, 2); - let res = arrayList.has("二"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_001 - * @tc.name : testGetIndexOf001 - * @tc.desc : In the ArrayList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. For example: arrayList.getIndexOf(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOf001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(1); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(1, 2); - let res1 = arrayList.getIndexOf(1); - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_002 - * @tc.name : testGetIndexOf002 - * @tc.desc : In the ArrayList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. For example: arrayList.getIndexOf("A"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOf002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(1); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.insert(1, 2); - let res = arrayList.getIndexOf("A"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_001 - * @tc.name : testRemoveByIndex001 - * @tc.desc : In the ArrayList instance, delete the element based on its index. - * For example: arrayList.removeByIndex(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByIndex001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.removeByIndex(2); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = ["四", "三", "a"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_002 - * @tc.name : testRemoveByIndex002 - * @tc.desc : In the ArrayList instance, delete the element based on its index index. - * For example: arrayList.removeByIndex(5). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByIndex002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("a"); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add("a"); - arrayList.add("b"); - try { - let res = arrayList.removeByIndex(5); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 5`); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_003 - * @tc.name : testRemoveByIndex003 - * @tc.desc : In the ArrayList instance, delete the element based on its index. - * For example: arrayList.removeByIndex.bind({})(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testRemoveByIndex003', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.removeByIndex.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The removeByIndex method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete the specified element . For example: arrayList.remove("三"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.remove("三"); - let res = arrayList.has("三"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete the specified element.For example: arrayList.remove("A"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - let res = arrayList.remove("A"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_REMOVE_003 - * @tc.name : testRemove003 - * @tc.desc : Delete the specified element. - * For example: arrayList.forEach((item, index) => {if (item == 1) {arrayList.remove(item);}}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(0); - arrayList.add(1); - arrayList.add(2); - arrayList.add(1); - arrayList.add(3); - arrayList.add(1); - arrayList.forEach((item, index) => { - if (item == 1) { - arrayList.remove(item); - } - }); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = [0, 2, 3]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_004 - * @tc.name : testRemove004 - * @tc.desc : Delete the specified element . For example: arrayList.remove.bind({})(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testRemove004', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.remove.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The remove method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_GET_LAST_INDEX_OF_001 - * @tc.name : testGetLastIndexOf001 - * @tc.desc : In the ArrayList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. For example: arrayList.add("四"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastIndexOf001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - arrayList.add("b"); - let res = arrayList.getLastIndexOf(1); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_REMOVE_BY_RANGE_001 - * @tc.name : testRemoveByRange001 - * @tc.desc : Deletes elements from a specified range, including elements at the start position and - * elements at the end position. For example: arrayList.removeByRange(1, 3). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByRange001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add(1); - arrayList.removeByRange(1, 3); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = ["四", "a", 1, "b", "c", 1]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_RANGE_002 - * @tc.name : testRemoveByRange002 - * @tc.desc : Add a string element to the end of the ArrayList instance. For example: arrayList.add("四"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByRange002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add(1); - try { - let res = arrayList.removeByRange(3, 1); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 0. Received value is: 3`); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_RANGE_003 - * @tc.name : testRemoveByRange003 - * @tc.desc : Deletes elements from a specified range, including elements at the start position and - * elements at the end position. For example: removeByRange(6, 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByRange003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - try { - let res = arrayList.removeByRange(6, 8); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 4. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_RANGE_004 - * @tc.name : testRemoveByRange004 - * @tc.desc : Deletes elements from a specified range, including elements at the start position and - * elements at the end position. For example: removeByRange(0, 7). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByRange004", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add(1); - arrayList.removeByRange(0, 8); - let res = arrayList.length; - let res1 = arrayList.getLastIndexOf(1); - expect(res).assertEqual(0); - expect(res1).assertEqual(-1); - }); - - /** - * @tc.number: TEST_REMOVE_BY_RANGE_005 - * @tc.name : testRemoveByRange005 - * @tc.desc : Deletes elements from a specified range, including elements at the start position and - * elements at the end position. For example: removeByRange(0, 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByRange005", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("四"); - arrayList.add("三"); - arrayList.add(1); - arrayList.add("a"); - arrayList.add(1); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add(1); - try { - arrayList.removeByRange(0, 9); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "toIndex" is out of range. It must be >= 0 && <= 8. Received value is: 9`); - } - }); - - /** - * @tc.number: TEST_REPLACE_ALL_ELEMENTS_001 - * @tc.name : testReplaceAllElements001 - * @tc.desc : Perform some operation on the elements in the ArrayList instance and return the ArrayList instance - * after the operation. For example: arrayList.replaceAllElements((item, index) => {return (item = 2 * item);}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplaceAllElements001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.replaceAllElements((item:number, index:number) => { - return (item = 2 * item); - }); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = [8, 6, 2, 4, 28]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traversing elements in an ArrayList instance. - * For example: arrayList.forEach((item, index) => {arr.push(item);}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traversing elements in an ArrayList instance. - * For example: arrayList.forEach.bind({}, "a")(() => {}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testForEach002', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.forEach.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The forEach method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_SORT_001 - * @tc.name : testSort001 - * @tc.desc : Arrange the elements in the ArrayList instance in descending order. - * For example: arrayList.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.sort((a:any, b:any) => a - b); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = [1, 2, 3, 4, 14]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SORT_002 - * @tc.name : testSort002 - * @tc.desc : Arrange the elements in the ArrayList instance in descending order. - * For example: arrayList.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("刘"); - arrayList.add("张三"); - arrayList.add(1); - arrayList.add(2); - arrayList.add("李四"); - arrayList.sort((a:any, b:any) => a - b); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = ["刘", "张三", 1, 2, "李四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SORT_003 - * @tc.name : testSort003 - * @tc.desc : Arrange the elements in the ArrayList instance in descending order. - * For example: arrayList.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("c"); - arrayList.add("a"); - arrayList.add("b"); - arrayList.add("e"); - arrayList.add("d"); - arrayList.sort((a:any, b:any) => a - b); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = ["c", "a", "b", "e", "d"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SUB_ARRAY_LIST_001 - * @tc.name : testSubArrayList001 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: arrayList.subArrayList(2, 4). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSubArrayList001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let subArr = arrayList.subArrayList(2, 4); - let arr = []; - subArr.forEach((item, index) => { - arr.push(item); - }); - let a = [1, 2]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SUB_ARRAY_LIST_002 - * @tc.name : testSubArrayList002 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: arrayList.subArrayList(4, 2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSubArrayList002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - try { - let subArr = arrayList.subArrayList(4, 2); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 1. Received value is: 4`); - } - }); - - /** - * @tc.number: TEST_SUB_ARRAY_LIST_003 - * @tc.name : testSubArrayList003 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: arrayList.subArrayList(0 ,6). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSubArrayList003", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let subArr = arrayList.subArrayList(0, 5); - let arr = []; - arrayList.forEach((item, index) => { - arr.push(item); - }); - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(a[i]).assertEqual(arr[i]); - } - }); - - /** - * @tc.number: TEST_SUB_ARRAY_LIST_004 - * @tc.name : testSubArrayList004 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: arrayList.subArrayList(6, 9). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSubArrayList004", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - try { - let subArr = arrayList.subArrayList(6, 9); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 4. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all elements in the ArrayList instance. For example: arrayList.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.clear(); - let res = arrayList.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all elements in the ArrayList instance. For example: arrayList.clear.bind({}, "a")(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testClear002', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.clear.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The clear method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_CLONE_001 - * @tc.name : testClone001 - * @tc.desc : Clone an ArrayList instance. For example: arrayList.clone(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClone001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let res = arrayList.clone(); - let arr = []; - res.forEach((item, index) => { - arr.push(item); - }); - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_GET_CAPACITY_001 - * @tc.name : testGetCapacity001 - * @tc.desc : Get the capacity of ArrayList instance. For example: arrayList.getCapacity(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCapacity001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let res = arrayList.getCapacity(); - expect(res).assertEqual(10); - }); - - /** - * @tc.number: TEST_GET_CAPACITY_002 - * @tc.name : testGetCapacity002 - * @tc.desc : Get the capacity of the ArrayList instance after capacity expansion. - * For example: arrayList.getCapacity(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCapacity002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.add("a"); - arrayList.add("b"); - arrayList.add("c"); - arrayList.add("d"); - arrayList.add("v"); - let a = [1, 2, 3, 4]; - arrayList.add(a); - let res = arrayList.getCapacity(); - expect(res).assertEqual(15); - }); - - /** - * @tc.number: TEST_CONVERT_TO_ARRAY_001 - * @tc.name : testConvertToArray001 - * @tc.desc : Convert an ArrayList instance to an array. For example: arrayList.convertToArray(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertToArray001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let arr = arrayList.convertToArray(); - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the ArrayList instance is empty. For example: arrayList.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.clear(); - let res = arrayList.isEmpty(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the ArrayList instance is empty. For example: arrayList.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - let res = arrayList.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_003 - * @tc.name : testIsEmpty003 - * @tc.desc : Determine whether the ArrayList instance is empty. For example: arrayList.isEmpty.bind({}, "a")(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testIsEmpty003', 0, function () { - let arrayList = new ArrayList(); - try { - arrayList.isEmpty.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The isEmpty method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_INCREASE_CAPACITY_TO_001 - * @tc.name : testIncreaseCapacityTo001 - * @tc.desc : Expand the ArrayList instance capacity to the specified value. - * For example: arrayList.increaseCapacityTo(8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIncreaseCapacityTo001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.increaseCapacityTo(8); - let res = arrayList.getCapacity(); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_INCREASE_CAPACITY_TO_002 - * @tc.name : testIncreaseCapacityTo002 - * @tc.desc : Expand the ArrayList instance capacity to the specified value. - * For example: arrayList.increaseCapacityTo(-1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIncreaseCapacityTo002", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.increaseCapacityTo(-1); - let res = arrayList.getCapacity(); - expect(res).assertEqual(10); - }); - - /** - * @tc.number: TEST_TRIM_TO_CURRENT_LENGTH_001 - * @tc.name : testTrimToCurrentLength001 - * @tc.desc : Limit the ArrayList instance capacity to the length of the ArrayList instance. - * For example: arrayList.trimToCurrentLength(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTrimToCurrentLength001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add(4); - arrayList.add(3); - arrayList.add(1); - arrayList.add(2); - arrayList.add(14); - arrayList.trimToCurrentLength(); - let res = arrayList.getCapacity(); - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterates over all elements in an ArrayList instance. For example: arrayList[Symbol.iterator](). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let arrayList = new ArrayList(); - arrayList.add("刘"); - arrayList.add("张三"); - arrayList.add(1); - arrayList.add(2); - arrayList.add("李四"); - let arr = []; - let itr = arrayList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["刘", "张三", 1, 2, "李四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - - }) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index e6d815a64aa8aef5a8b31a88b74aa9c3ec797d30..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import ArraylistTest from './ArrayList.test' - -export default function testsuite() { - ArraylistTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryArrayListetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/app.json deleted file mode 100755 index 850c82b46fdc14a307aa806bb7fe3e140aa43179..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.LightWeightMap.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/BUILD.gn deleted file mode 100755 index 3c1999d24ebdef97276522698555711366ab9a23..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/BUILD.gn +++ /dev/null @@ -1,50 +0,0 @@ -# Copyright (C) 2023 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. - -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformLightWeightMapTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformLightWeightMapTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/Test.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/Test.json deleted file mode 100755 index ccf9263980f7c8830d55ef4c75e2237158cf0831..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - - "driver": { - "type": "OHJSUnitTest", - - "test-timeout": "60000", - - "shell-timeout": "60000", - - "bundle-name": "ohos.acts.commonlibrary.crossplatform.LightWeightMap.normal", - - "module-name": "entry_test" - - - }, - - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformLightWeightMapTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/signature/openharmony_sx.p7b deleted file mode 100755 index a564e5988cc9f4f28aceb2243a5881aa2276df42..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index dbc536ca80c5095e2bcb95bdf9ce4659ea973139..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/LightWeightMap.test.ets b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/LightWeightMap.test.ets deleted file mode 100755 index f97f2aa6c0df955ab966838e977ad41f10fe7d37..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/LightWeightMap.test.ets +++ /dev/null @@ -1,1194 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import LightWeightMap from "@ohos.util.LightWeightMap"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function LightWeightMapTest() { -describe("LightWeightMapTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name: testConstructor001 - * @tc.desc: Create an LightWeightMap instance. For example: let lightWeightMap = new LightWeightMap(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConstructor001", 0, function () { - try { - let lightWeightMap = new LightWeightMap(); - expect(lightWeightMap != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The LightWeightMap's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name: testLength001 - * @tc.desc: Get the number of key value pairs in the lightWeightMap instance. For example: lightWeightMap.length. - * @tc.size: MediumTest - * @tc.type: Field - * @tc.level: level 1 - */ - it("testLength001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_HASALL_001 - * @tc.name: testHasAll001 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let lightWeightMap1 = new LightWeightMap(); - lightWeightMap1.set("a", "A"); - lightWeightMap1.set("d", "D"); - let res = lightWeightMap.hasAll(lightWeightMap1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HASALL_002 - * @tc.name: testHasAll002 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let lightWeightMap1 = new LightWeightMap(); - lightWeightMap1.set("a1", "A1"); - lightWeightMap1.set("d1", "D1"); - let res = lightWeightMap.hasAll(lightWeightMap1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HASALL_003 - * @tc.name: testHasAll003 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll003", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let lightWeightMap1 = new LightWeightMap(); - lightWeightMap1.set("a", "A1"); - lightWeightMap1.set("d", "D1"); - let res = lightWeightMap.hasAll(lightWeightMap1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HASALL_004 - * @tc.name: testHasAll004 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll004", 0, function () { - let lightWeightMap = new LightWeightMap(); - let lightWeightMap1 = new LightWeightMap(); - let res = lightWeightMap.hasAll(lightWeightMap1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HASALL_005 - * @tc.name: testHasAll005 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll005", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let lightWeightMap1 = new LightWeightMap(); - lightWeightMap1.set("a", "A"); - lightWeightMap1.set("d", "D1"); - let res = lightWeightMap.hasAll(lightWeightMap1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HASALL_006 - * @tc.name: testHasAll006 - * @tc.desc: Judge whether a lightweightmap contains all key value pairs in another lightweightmap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasAll006", 0, function () { - let lightWeightMap = new LightWeightMap(); - try { - //@ts-ignore - lightWeightMap.hasAll([1, 2, 3]); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "map" must be LightWeightMap. Received value is: 1,2,3`); - } - }); - - /** - * @tc.number: TEST_HASKEY_001 - * @tc.name: testHasKey001 - * @tc.desc: Determine whether the LightWeightMap contains the specified key. For example: lightWeightMap.hasKey("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasKey001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let res = lightWeightMap.hasKey("a"); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_HASVALUE_001 - * @tc.name: testHasValue001 - * @tc.desc: Determine whether the LightWeightMap contains the specified value. - * For example: lightWeightMap.hasValue("A"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHasValue001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let res = lightWeightMap.hasValue("A"); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasValue(1); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_INCREASECAPACITYTO_001 - * @tc.name: testIncreaseCapacityTo001 - * @tc.desc: Expand the LightWeightMap instance capacity to the specified value. - * For example: lightWeightMap.increaseCapacityTo(3). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIncreaseCapacityTo001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - lightWeightMap.increaseCapacityTo(3); - let length = lightWeightMap.length; - expect(length).assertEqual(5); - }); - - /** - * @tc.number: TEST_INCREASECAPACITYTO_002 - * @tc.name: testIncreaseCapacityTo002 - * @tc.desc: Expand the LightWeightMap instance capacity to the specified value. - * For example: lightWeightMap.increaseCapacityTo(10). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIncreaseCapacityTo002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - let res = lightWeightMap.increaseCapacityTo(10); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_INCREASECAPACITYTO_003 - * @tc.name: testIncreaseCapacityTo003 - * @tc.desc: Expand the LightWeightMap instance capacity to the specified value. - * For example: lightWeightMap.increaseCapacityTo("qwe"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIncreaseCapacityTo003", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - lightWeightMap.set("b", "B"); - lightWeightMap.set("c", "C"); - lightWeightMap.set("d", "D"); - lightWeightMap.set("e", "E"); - try { - //@ts-ignore - lightWeightMap.increaseCapacityTo("qwe"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "minimumCapacity" must be number. Received value is: qwe`); - } - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name: testEntries001 - * @tc.desc: Get all key value pairs collection in lightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testEntries001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.entries(); - expect(JSON.stringify(res.next().value)).assertEqual('[1,"A"]'); - expect(JSON.stringify(res.next().value)).assertEqual('[2,"B"]'); - expect(JSON.stringify(res.next().value)).assertEqual('[3,"C"]'); - expect(JSON.stringify(res.next().value)).assertEqual('[4,"D"]'); - expect(JSON.stringify(res.next().value)).assertEqual('[5,"E"]'); - }); - - /** - * @tc.number: TEST_GET_001 - * @tc.name: testGet001 - * @tc.desc: Get the corresponding value through the key. For example: lightWeightMap.get(4). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.get(4); - expect(res).assertEqual("D"); - }); - - /** - * @tc.number: TEST_GET_002 - * @tc.name: testGet002 - * @tc.desc: Get the corresponding value through the key. For example: lightWeightMap.get(10). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.get(10); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GETINDEXOFKEY_001 - * @tc.name: testGetIndexOfKey001 - * @tc.desc: Find the index of the key value pair according to the corresponding key. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - * If no key is specified, return -1. - */ - it("testGetIndexOfKey001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.getIndexOfKey(2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GETINDEXOFKEY_002 - * @tc.name: testGetIndexOfKey002 - * @tc.desc: Find the index of the key value pair according to the corresponding key. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - * If no key is specified, return -1. - */ - it("testGetIndexOfKey002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.getIndexOfKey(10); - expect(res).assertEqual(-1); - }); - - - - /** - * @tc.number: TEST_GETINDEXOFVALUE_001 - * @tc.name: testGetIndexOfValue001 - * @tc.desc: Find the index of the key value pair according to the corresponding value. - * If no key is specified, return -1. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOfValue001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - lightWeightMap.setValueAt(4, "F"); - let res = lightWeightMap.getIndexOfValue("F"); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_GETINDEXOFVALUE_002 - * @tc.name: testGetIndexOfValue002 - * @tc.desc: Find the index of the key value pair according to the corresponding value. - * If no key is specified, return -1. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOfValue002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - lightWeightMap.setValueAt(4, "F"); - let res = lightWeightMap.getIndexOfValue("H"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_ISEMPTY_001 - * @tc.name: testIsEmpty001 - * @tc.desc: Determine whether the LightWeightMap instance is empty. For example: lightWeightMap.isEmpty(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIsEmpty001", 0, function () { - let lightWeightMap = new LightWeightMap(); - let res1 = lightWeightMap.isEmpty(); - expect(res1).assertEqual(true); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res2 = lightWeightMap.isEmpty(); - expect(res2).assertEqual(false); - }); - - /** - * @tc.number: TEST_GETKEYAT_001 - * @tc.name: testGetKeyAt001 - * @tc.desc: Find the key of the key value pair according to the corresponding index. - * For example: lightWeightMap.getKeyAt(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetKeyAt001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.getKeyAt(1); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_GETKEYAT_002 - * @tc.name: testGetKeyAt002 - * @tc.desc: Find the key of the key value pair according to the corresponding index. - * For example: lightWeightMap.getKeyAt("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetKeyAt002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - try { - //@ts-ignore - let res = lightWeightMap.getKeyAt("a"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number: TEST_GETKEYAT_003 - * @tc.name: testGetKeyAt003 - * @tc.desc: Find the key of the key value pair according to the corresponding index. - * For example: lightWeightMap.getKeyAt(6). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetKeyAt003", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - try { - let res = lightWeightMap.getKeyAt(6); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_KEYS_001 - * @tc.name: testKeys001 - * @tc.desc: Get a collection of all the keys in the LightWeightMap. For example: lightWeightMap.keys(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testKeys001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.keys(); - expect(res.next().value).assertEqual(1); - expect(res.next().value).assertEqual(2); - expect(res.next().value).assertEqual(3); - expect(res.next().value).assertEqual(4); - expect(res.next().value).assertEqual(5); - }); - - /** - * @tc.number: TEST_SETALL_001 - * @tc.name: testSetAll001 - * @tc.desc: Copy key value pairs from one LightWeightMap to another. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSetAll001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let lightWeightMap1 = new LightWeightMap(); - lightWeightMap1.set(6, "A"); - lightWeightMap1.set(7, "B"); - lightWeightMap.setAll(lightWeightMap1); - for (let i = 1; i < 8; i++) { - expect(lightWeightMap.hasKey(i)).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_SETALL_002 - * @tc.name: testSetAll002 - * @tc.desc: Copy key value pairs from one LightWeightMap to another. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSetAll002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - try { - //@ts-ignore - lightWeightMap.setAll([1, 2, 3]); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "map" must be LightWeightMap. Received value is: 1,2,3`); - } - }); - - /** - * @tc.number: TEST_SET_001 - * @tc.name: testSet001 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set(1, "A"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - let res = lightWeightMap.hasValue("A"); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_002 - * @tc.name: testSet002 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set("a", "A"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set("a", "A"); - let res = lightWeightMap.hasValue("A"); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey("a"); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_003 - * @tc.name: testSet003 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set("a", "A"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet003", 0, function () { - let lightWeightMap = new LightWeightMap(); - let a = [1, 2, 3, 4]; - lightWeightMap.set(1, a); - let res = lightWeightMap.hasValue(a); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_004 - * @tc.name: testSet004 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet004", 0, function () { - let lightWeightMap = new LightWeightMap(); - let c = {name: "lili", age: "13"}; - lightWeightMap.set(1, c); - let res = lightWeightMap.hasValue(c); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_005 - * @tc.name: testSet005 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set(1, null). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet005", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, null); - let res = lightWeightMap.hasValue(null); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_006 - * @tc.name: testSet006 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set(null, null). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet006", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(null, null); - let res = lightWeightMap.hasValue(null); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(null); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_007 - * @tc.name: testSet007 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set(true, false). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet007", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(true, false); - let res = lightWeightMap.hasValue(false); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(true); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_008 - * @tc.name: testSet008 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. For example: lightWeightMap.set(1.23, 321). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet008", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1.23, 321); - let res = lightWeightMap.hasValue(321); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(1.23); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_009 - * @tc.name: testSet009 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet009", 0, function () { - let lightWeightMap = new LightWeightMap(); - for (let i = 0; i < 100; i++) { - lightWeightMap.set(i, "A"); - } - let res = lightWeightMap.get(99); - expect(res).assertEqual("A"); - let res1 = lightWeightMap.length; - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_SET_010 - * @tc.name: testSet010 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet010", 0, function () { - let lightWeightMap = new LightWeightMap(); - for (let i = 0; i < 100; i++) { - lightWeightMap.set(1, i); - } - let res = lightWeightMap.get(1); - expect(res).assertEqual(99); - let res1 = lightWeightMap.length; - expect(res1).assertEqual(1); - }); - - /** - * @tc.number: TEST_SET_011 - * @tc.name: testSet011 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet011", 0, function () { - let lightWeightMap = new LightWeightMap(); - for (let i = 0; i < 10000; i++) { - lightWeightMap.set(i, i); - } - let res1 = lightWeightMap.length; - expect(res1).assertEqual(10000); - for (let index = 0; index < 10000; index++) { - let resKey = lightWeightMap.hasKey(index); - expect(resKey).assertEqual(true); - let resValue = lightWeightMap.hasValue(index); - expect(resValue).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_SET_012 - * @tc.name: testSet012 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet012", 0, function () { - let lightWeightMap = new LightWeightMap(); - for (let i = 0; i < 5000; i++) { - lightWeightMap.set(i, i); - } - for (let i = -1; i > -5001; i--) { - lightWeightMap.set(i, i); - } - let res1 = lightWeightMap.length; - expect(res1).assertEqual(10000); - for (let index = 0; index < 5000; index++) { - let resKey = lightWeightMap.hasKey(index); - expect(resKey).assertEqual(true); - let resValue = lightWeightMap.hasValue(index); - expect(resValue).assertEqual(true); - } - for (let i = -1; i > -5001; i--) { - let resKey = lightWeightMap.hasKey(i); - expect(resKey).assertEqual(true); - let resValue = lightWeightMap.hasValue(i); - expect(resValue).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_SET_013 - * @tc.name: testSet013 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet013", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(true, 0.001); - let res = lightWeightMap.hasValue(0.001); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(true); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_014 - * @tc.name: testSet014 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet014", 0, function () { - let lightWeightMap = new LightWeightMap(); - let a = [1, 2, 3, 4]; - lightWeightMap.set(a, 1); - let res = lightWeightMap.hasValue(1); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(a); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_015 - * @tc.name: testSet015 - * @tc.desc: Add a pair of key value pairs to the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet015", 0, function () { - let lightWeightMap = new LightWeightMap(); - let a = {abc: 1}; - lightWeightMap.set(a, ""); - let res = lightWeightMap.hasValue(""); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasKey(a); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name: testRemove001 - * @tc.desc: Delete key value pairs according to key. For example: lightWeightMap.remove(3). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.remove(3); - expect(res).assertEqual("C"); - let res1 = lightWeightMap.hasValue("C"); - expect(res1).assertEqual(false); - }); - - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name: testRemove002 - * @tc.desc: Delete key value pairs according to key. For example: lightWeightMap.remove(3). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove002", 0, function () { - let lightWeightMap = new LightWeightMap(); - let res = lightWeightMap.remove(3); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVEAT_001 - * @tc.name: testRemoveAt001 - * @tc.desc: Delete key value pairs according to index. For example: lightWeightMap.removeAt(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveAt001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.removeAt(1); - expect(res).assertEqual(true); - let res1 = lightWeightMap.hasValue("A"); - expect(res1).assertEqual(true); - let res2 = lightWeightMap.hasValue("B"); - expect(res2).assertEqual(false); - let res3 = lightWeightMap.removeAt(10); - expect(res3).assertEqual(false); - }); - - /** - * @tc.number: TEST_REMOVEAT_002 - * @tc.name: testRemoveAt002 - * @tc.desc: Delete key value pairs according to index. For example: lightWeightMap.removeAt(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveAt002", 0, function () { - let lightWeightMap = new LightWeightMap(); - let res = lightWeightMap.removeAt(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_REMOVEAT_003 - * @tc.name: testRemoveAt003 - * @tc.desc: Delete key value pairs according to index. For example: lightWeightMap.removeAt("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveAt003", 0, function () { - let lightWeightMap = new LightWeightMap(); - try { - //@ts-ignore - let res = lightWeightMap.removeAt("a"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name: testClear001 - * @tc.desc: Clear all key value pairs in LightWeightMap. For example: lightWeightMap.clear(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClear001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - lightWeightMap.clear(); - let res = lightWeightMap.length; - expect(res).assertEqual(0); - let isEmpty = lightWeightMap.isEmpty(); - expect(isEmpty).assertEqual(true); - }); - - /** - * @tc.number: TEST_SETVALUEAT_001 - * @tc.name: testSetValueAt001 - * @tc.desc: Modify the value of the key value pair according to the corresponding index. - * For example: setValueAt(0, "a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSetValueAt001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - lightWeightMap.setValueAt(0, "a"); - let res = lightWeightMap.get(1); - expect(res).assertEqual("a"); - }); - - /** - * @tc.number: TEST_FOREACH_001 - * @tc.name: testForEach001 - * @tc.desc: Traverse all key value pairs in the LightWeightMap instance. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let arr = []; - lightWeightMap.forEach((value, index) => { - arr.push(value); - }); - let arr1 = ["A", "B", "C", "D", "E"]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name: testIterator001 - * @tc.desc: Iterate over all key value pairs in the LightWeightMap. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let iters = lightWeightMap[Symbol.iterator](); - let flag = true; - for (let i = 0, len = lightWeightMap.length; i < len; i++) { - let entry = iters.next().value; - let res = lightWeightMap.get(entry[0]); - if (res != entry[1]) { - flag = false; - break; - } - } - expect(flag).assertEqual(true); - }); - - /** - * @tc.number: TEST_TOSTRING_001 - * @tc.name: testToString001 - * @tc.desc: Use "," to splice the elements in the LightWeightMap instance into a string. - * For example: lightWeightMap.toString(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testToString001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - let res = lightWeightMap.toString(); - expect(res).assertEqual("1:A,2:B,3:C"); - }); - - /** - * @tc.number: TEST_GETVALUEAT_001 - * @tc.name: testGetValueAt001 - * @tc.desc: Get the value of the key value pair according to the corresponding index. - * For example: lightWeightMap.getValueAt(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetValueAt001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.getValueAt(1); - expect(res).assertEqual("B"); - }); - - /** - * @tc.number: TEST_GETVALUEAT_002 - * @tc.name: testGetValueAt002 - * @tc.desc: Get the value of the key value pair according to the corresponding index. - * For example: lightWeightMap.getValueAt("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetValueAt002", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - try { - //@ts-ignore - let res = lightWeightMap.getValueAt("a"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number: TEST_GETVALUEAT_003 - * @tc.name: testGetValueAt003 - * @tc.desc: Get the value of the key value pair according to the corresponding index. - * For example: lightWeightMap.getValueAt(6). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetValueAt003", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - try { - lightWeightMap.getValueAt(6); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name: testValues001 - * @tc.desc: Get a collection of all the values in the LightWeightMap. For example: lightWeightMap.values(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testValues001", 0, function () { - let lightWeightMap = new LightWeightMap(); - lightWeightMap.set(1, "A"); - lightWeightMap.set(2, "B"); - lightWeightMap.set(3, "C"); - lightWeightMap.set(4, "D"); - lightWeightMap.set(5, "E"); - let res = lightWeightMap.values(); - expect(res.next().value).assertEqual("A"); - expect(res.next().value).assertEqual("B"); - expect(res.next().value).assertEqual("C"); - expect(res.next().value).assertEqual("D"); - expect(res.next().value).assertEqual("E"); - }); - }); -} - diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 6c2304d1698ae060973cfb616c485cb4c6e58866..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import LightWeightMap from './LightWeightMap.test' - -export default function testsuite() { - LightWeightMap() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightMapetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/app.json deleted file mode 100755 index a91efea27fa2b39b34ede0b70bc50b52ffe4bd31..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.LightWeightSet.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/BUILD.gn deleted file mode 100755 index ce8c35125290f12f56322e21c86db7103c5ac22e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossPlatformLightWeightSetTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossPlatformLightWeightSetTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/Test.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/Test.json deleted file mode 100755 index db81cbae41e3687f5736301befc3808895f48594..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.LightWeightSet.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsDemoStageTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/signature/openharmony_sx.p7b deleted file mode 100755 index be064a613c16767b3cfffdc914edab6435bdfdd5..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index cb027d69256099790b95a32b446978bbc64b4ecb..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 8cbc4b3b96d8d38bc36fbd9a3173d3fd4f09db73..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/LightWeightSet.test.ets b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/LightWeightSet.test.ets deleted file mode 100755 index 89bbcbe41185f6426d5642e631d04135253039a2..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/LightWeightSet.test.ets +++ /dev/null @@ -1,799 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import LightWeightSet from "@ohos.util.LightWeightSet"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function LightWeightSetTest() { - describe("LightWeightSetTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an LightWeightSet instance. For example: let lightWeightSet = new LightWeightSet(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - try { - let lightWeightSet = new LightWeightSet(); - expect(lightWeightSet != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The LightWeightSet's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of element in the LightWeightSet instance. For example: lightWeightSet.length. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 1 - */ - it("testLength001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - let res = lightWeightSet.has(1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add("a"); - let res = lightWeightSet.has("a"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add element to LightWeightSet instance. - * For example: let a = [1, 2, 3, 4]; lightWeightSet.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let lightWeightSet = new LightWeightSet(); - let a = [1, 2, 3, 4]; - lightWeightSet.add(a); - let res = lightWeightSet.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add element to LightWeightSet instance. - * For example: let a = {name: "lili", age: "13"}; lightWeightSet.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let lightWeightSet = new LightWeightSet(); - let c = {name: "lili", age: "13"}; - lightWeightSet.add(c); - let res = lightWeightSet.has(c); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add element to LightWeightSet instance. For example: let c = false; lightWeightSet.add(c). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let lightWeightSet = new LightWeightSet(); - let c = false; - lightWeightSet.add(c); - let res = lightWeightSet.has(c); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add(null). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(null); - let res = lightWeightSet.has(null); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add(1.23). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1.23); - let res1 = lightWeightSet.has(1.23); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add element to LightWeightSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let lightWeightSet = new LightWeightSet(); - for (let i = 0; i < 10000; i++) { - lightWeightSet.add(i); - } - let res = lightWeightSet.getValueAt(9999); - let res1 = lightWeightSet.length; - expect(res).assertEqual(9999); - expect(res1).assertEqual(10000); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add(""). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(""); - let res = lightWeightSet.has(""); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add element to LightWeightSet instance. For example: lightWeightSet.add("$"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add("$"); - let res = lightWeightSet.has("$"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_ALL_001 - * @tc.name : testAddAll001 - * @tc.desc : Copy all element from one LightWeightSet to another. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddAll001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let lightWeightSet1 = new LightWeightSet(); - lightWeightSet1.add(6); - lightWeightSet1.add(7); - let res1 = lightWeightSet.addAll(lightWeightSet1); - for (let item of lightWeightSet) { - console.log("lightWeightSet-----" + item); - } - for (let item of lightWeightSet1) { - console.log("lightWeightSet1-----" + item); - } - for (let i = 1; i < 8; i++) { - expect(lightWeightSet.has(i)).assertEqual(true); - } - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_ALL_001 - * @tc.name : testHasAll001 - * @tc.desc : Judge whether a lightWeightSet contains all elements in another lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasAll001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add("a"); - lightWeightSet.add("b"); - lightWeightSet.add("c"); - lightWeightSet.add("d"); - lightWeightSet.add("e"); - let lightWeightSet1 = new LightWeightSet(); - lightWeightSet1.add("a"); - lightWeightSet1.add("d"); - let res = lightWeightSet.hasAll(lightWeightSet1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_ALL_002 - * @tc.name : testHasAll002 - * @tc.desc : Judge whether a lightWeightSet contains all elements in another lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasAll002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add("a"); - lightWeightSet.add("b"); - lightWeightSet.add("c"); - lightWeightSet.add("e"); - let lightWeightSet1 = new LightWeightSet(); - lightWeightSet1.add("a"); - lightWeightSet1.add("d"); - let res = lightWeightSet.hasAll(lightWeightSet1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_ALL_003 - * @tc.name : testHasAll003 - * @tc.desc : Judge whether a lightWeightSet contains all elements in another lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasAll003", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let lightWeightSet1 = new LightWeightSet(); - lightWeightSet1.add("a1"); - lightWeightSet1.add("d1"); - let res = lightWeightSet.hasAll(lightWeightSet1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_ALL_004 - * @tc.name : testHasAll004 - * @tc.desc : Judge whether a lightWeightSet contains all elements in another lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasAll004", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let lightWeightSet1 = new LightWeightSet(); - lightWeightSet1.add(1); - lightWeightSet1.add("d"); - let res = lightWeightSet.hasAll(lightWeightSet1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Judge whether a lightWeightSet contains all elements in another lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add("a"); - lightWeightSet.add("b"); - lightWeightSet.add("c"); - lightWeightSet.add("d"); - lightWeightSet.add("e"); - let res = lightWeightSet.has("a"); - expect(res).assertEqual(true); - let res1 = lightWeightSet.has(1); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUAL_001 - * @tc.name : testEqual001 - * @tc.desc : Compare lightWeightMap and specified object for equality. For example: lightWeightSet.equal(obj). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - let obj = [1,2,3]; - let res = lightWeightSet.equal(obj); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUAL_002 - * @tc.name : testEqual002 - * @tc.desc : Compare lightWeightMap and specified object for equality. For example: lightWeightSet.equal(obj). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - let obj = [1,2]; - let res = lightWeightSet.equal(obj); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_INCREASE_CAPACITY_TO_001 - * @tc.name : testIncreaseCapacityTo001 - * @tc.desc : Expand the LightWeightSet capacity to the specified value. - * For example: lightWeightSet.increaseCapacityTo(3). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIncreaseCapacityTo001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - try { - lightWeightSet.increaseCapacityTo(3); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "minimumCapacity" is out of range. It must be > 8. Received value is: 3`); - } - }); - - /** - * @tc.number: TEST_INCREASE_CAPACITY_TO_002 - * @tc.name : testIncreaseCapacityTo002 - * @tc.desc : Expand the LightWeightSet capacity to the specified value. - * For example: lightWeightSet.increaseCapacityTo(20). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIncreaseCapacityTo002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.increaseCapacityTo(20); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_001 - * @tc.name : testGetIndexOf001 - * @tc.desc : Get the index according to the specified element. For example: lightWeightSet.getIndexOf(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOf001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.getIndexOf(2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete elements according to key. For example: lightWeightMap.remove(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.remove(1); - expect(res).assertEqual(1); - let arr = []; - lightWeightSet.forEach((value, index) => { - arr.push(value); - }); - let arr1 = [2, 3, 4, 5]; - for (let i = 0; i < arr.length; i++) { - expect(arr1[i]).assertEqual(arr[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete elements according to key. For example: lightWeightMap.remove(3). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let lightWeightSet = new LightWeightSet(); - let res = lightWeightSet.remove(3); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_003 - * @tc.name : testRemove003 - * @tc.desc : Delete elements according to key. For example: lightWeightMap.remove("A"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove003", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.remove("A"); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_AT_001 - * @tc.name : testRemoveAt001 - * @tc.desc : Delete elements according to index. For example: lightWeightSet.removeAt(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveAt001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.removeAt(1); - expect(res).assertEqual(true); - let arr = []; - lightWeightSet.forEach((value, index) => { - arr.push(value); - }); - let arr1 = [1, 3, 4, 5]; - for (let i = 0; i < arr.length; i++) { - expect(arr1[i]).assertEqual(arr[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_AT_002 - * @tc.name : testRemoveAt002 - * @tc.desc : Delete elements according to index. For example: lightWeightSet.removeAt(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveAt002", 0, function () { - let lightWeightSet = new LightWeightSet(); - let res = lightWeightSet.removeAt(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all elements in LightWeightSet. For example: lightWeightSet.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - lightWeightSet.clear(); - let res = lightWeightSet.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all elements in LightWeightSet. For example: lightWeightSet.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.length; - lightWeightSet.clear(); - let res1 = lightWeightSet.length; - expect(res).assertEqual(5); - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse all elements in the LightWeightSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let arr = []; - lightWeightSet.forEach((value, index) => { - arr.push(value); - }); - let arr1 = [1, 2, 3, 4, 5]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all elements in the LightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let arr = []; - let res = lightWeightSet[Symbol.iterator](); - let temp = undefined; - do { - temp = res.next().value; - arr.push(temp); - } while (temp != undefined); - let arr1 = [1, 2, 3, 4, 5]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_TO_STRING_001 - * @tc.name : testToString001 - * @tc.desc : Use "," to splice the elements in the LightWeightSet instance into a string. - * For example: lightWeightSet.toString(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - let res = lightWeightSet.toString(); - expect(res).assertEqual("1,2,3"); - }); - - /** - * @tc.number: TEST_TO_ARRAY_001 - * @tc.name : testToArray001 - * @tc.desc : Convert an lightWeightSet instance to an array. For example: lightWeightSet.toArray(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToArray001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.toArray(); - let arr1 = [1, 2, 3, 4, 5]; - for (let i = 0; i < arr1.length; i++) { - expect(res[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_GET_VALUE_AT_001 - * @tc.name : testGetValueAt001 - * @tc.desc : Get the element according to the corresponding index. For example: lightWeightSet.getValueAt(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetValueAt001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.getValueAt(1); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Get a collection of all the values in the LightWeightSet. For example: lightWeightSet.values(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testValues001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.values(); - expect(res.next().value).assertEqual(1); - expect(res.next().value).assertEqual(2); - expect(res.next().value).assertEqual(3); - expect(res.next().value).assertEqual(4); - expect(res.next().value).assertEqual(5); - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Get all key value pairs collection in lightWeightSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.entries(); - expect(JSON.stringify(res.next().value)).assertEqual("[1,1]"); - expect(JSON.stringify(res.next().value)).assertEqual("[2,2]"); - expect(JSON.stringify(res.next().value)).assertEqual("[3,3]"); - expect(JSON.stringify(res.next().value)).assertEqual("[4,4]"); - expect(JSON.stringify(res.next().value)).assertEqual("[5,5]"); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the lightWeightSet instance is empty. For example: lightWeightSet.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - let res = lightWeightSet.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the lightWeightSet instance is empty. For example: lightWeightSet.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let lightWeightSet = new LightWeightSet(); - lightWeightSet.add(1); - lightWeightSet.add(2); - lightWeightSet.add(3); - lightWeightSet.add(4); - lightWeightSet.add(5); - lightWeightSet.clear(); - let res = lightWeightSet.isEmpty(); - expect(res).assertEqual(true); - }); - - - }) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 273d304c77b07188b482e8d9b3fc9f930014a2aa..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import LightWeightSetTest from './LightWeightSet.test' - -export default function testsuite() { - LightWeightSetTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLightWeightSetetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/app.json deleted file mode 100755 index 6a78e9664db88b1b8229d9d493d35cefcef2d24c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.LinkedList.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/BUILD.gn deleted file mode 100755 index 9e206305c74c5fea24a37d88e97a74bcb12158ee..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformLinkedListTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformLinkedListTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/Test.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/Test.json deleted file mode 100755 index a2e5225b76407dcbcc0657aa3d789da5fede7d98..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - - "driver": { - "type": "OHJSUnitTest", - - "test-timeout": "60000", - - "shell-timeout": "60000", - - "bundle-name": "ohos.acts.commonlibrary.crossplatform.LinkedList.normal", - - "module-name": "entry_test" - - - }, - - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformLinkedListTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/signature/openharmony_sx.p7b deleted file mode 100755 index 092fbe388e4e1c37f6abd61fda27c1be08afeba3..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/LinkedList.test.ets b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/LinkedList.test.ets deleted file mode 100755 index d5f0fcc46ffecef6868f5927a5e36ed27c68fefe..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/LinkedList.test.ets +++ /dev/null @@ -1,2411 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import LinkedList from "@ohos.util.LinkedList"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function LinkedListTest() { -describe("LinkedListTest", function () { - - /** - * @tc.number:TEST_CONSTRUCTOR_001 - * @tc.name: testConstructor001 - * @tc.desc: Create an LinkedList instance. For example: let linkedList = new LinkedList(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConstructor001", 0, function () { - try { - let linkedList = new LinkedList(); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The LinkedList's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number:TEST_LENGTH_001 - * @tc.name: testLength001 - * @tc.desc: Get the number of elements in the LinkedList instance. For example: linkedList.length. - * @tc.size: MediumTest - * @tc.type: Field - * @tc.level: level 1 - */ - it("testLength001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(4); - linkedList.add(3); - linkedList.add(1); - linkedList.add(2); - linkedList.add(14); - let res = linkedList.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number:TEST_ADD_001 - * @tc.name: testAdd001 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add("四"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("四"); - let res = linkedList.get(0); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number:TEST_ADD_002 - * @tc.name: testAdd002 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add(8). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(8); - let res = linkedList.get(0); - expect(res).assertEqual(8); - }); - - /** - * @tc.number:TEST_ADD_003 - * @tc.name: testAdd003 - * @tc.desc: Add a element to the end of the LinkedList instance. - * For example: let a = [1, 2, 3, 4];linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd003", 0, function () { - let linkedList = new LinkedList(); - let a = [1, 2, 3, 4]; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_004 - * @tc.name: testAdd004 - * @tc.desc: Add a element to the end of the LinkedList instance. - * For example: let a = {name: "lala", age: "13"};linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd004", 0, function () { - let linkedList = new LinkedList(); - let a = {name: "lala", age: "13"}; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_005 - * @tc.name: testAdd005 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: let a = ".";linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd005", 0, function () { - let linkedList = new LinkedList(); - let a = "."; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_006 - * @tc.name: testAdd006 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: let a = "*";linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd006", 0, function () { - let linkedList = new LinkedList(); - let a = "*"; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_007 - * @tc.name: testAdd007 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: let a = "/";linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd007", 0, function () { - let linkedList = new LinkedList(); - let a = '/"'; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_008 - * @tc.name: testAdd008 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: let a = "";linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd008", 0, function () { - let linkedList = new LinkedList(); - let a = ""; - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_009 - * @tc.name: testAdd009 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: let a = "a";linkedList.add(a). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd009", 0, function () { - let linkedList = new LinkedList(); - let a = "a"; - linkedList.add(a); - linkedList.add(a); - let res = linkedList.get(0); - expect(res).assertEqual(a); - let res1 = linkedList.get(1); - expect(res1).assertEqual(a); - }); - - /** - * @tc.number:TEST_ADD_010 - * @tc.name: testAdd010 - * @tc.desc: Add a element to the end of the LinkedList instance. - * For example: for (let i = 0; i < 100; i++) {linkedList.add(i);}. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd010", 0, function () { - let linkedList = new LinkedList(); - for (let i = 0; i < 100; i++) { - linkedList.add(i); - } - let res = linkedList.get(99); - expect(res).assertEqual(99); - }); - - /** - * @tc.number:TEST_ADD_011 - * @tc.name: testAdd011 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add(null). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd054", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(null); - let res = linkedList.get(0); - expect(res).assertEqual(null); - }); - - /** - * @tc.number:TEST_ADD_012 - * @tc.name: testAdd012 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add(0.1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd055", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(0.1); - let res = linkedList.get(0); - expect(res).assertEqual(0.1); - }); - - /** - * @tc.number:TEST_ADD_013 - * @tc.name: testAdd013 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add(-1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level:level 2 - */ - it("testAdd056", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(-1); - let res = linkedList.get(0); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number:TEST_ADD_014 - * @tc.name: testAdd014 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: const obj = {}; linkedList.add(obj). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAdd014", 0, function () { - let linkedList = new LinkedList(); - const obj = {}; - linkedList.add(obj); - let res = linkedList.get(0); - expect(res).assertEqual(obj); - }); - - /** - * @tc.number:TEST_ADD_015 - * @tc.name: testAdd015 - * @tc.desc: Add a element to the end of the LinkedList instance. For example: linkedList.add.bind({}, obj)(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAdd015", 0, function () { - let linkedList = new LinkedList(); - try { - linkedList.add.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - - - /** - * @tc.number:TEST_INSERT_001 - * @tc.name: testInsert001 - * @tc.desc: Insert an element into the middle of the LinkedList instance. For example: linkedList.insert(3, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testInsert001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.insert(3, "d"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "d", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_INSERT_002 - * @tc.name: testInsert002 - * @tc.desc: Insert an element into the middle of the LinkedList instance. For example: linkedList.insert(0, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testInsert002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.insert(0, "d"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["d", "a", "b", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_INSERT_003 - * @tc.name: testInsert003 - * @tc.desc: Insert an element into the middle of the LinkedList instance. For example: linkedList.insert(5, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testInsert003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.insert(5, "d"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "a", "b", "d"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_INSERT_004 - * @tc.name: testInsert004 - * @tc.desc: Insert an element into the middle of the LinkedList instance. For example: linkedList.insert(9, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testInsert004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - try { - let res = linkedList.insert(8, "d"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 5. Received value is: 8`); - } - }); - - /** - * @tc.number:TEST_INSERT_005 - * @tc.name: testInsert005 - * @tc.desc: Insert an element into the middle of the LinkedList instance. For example: linkedList.insert("a", "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testInsert005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - try { - //@ts-ignore - linkedList.insert("a", "d"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - - - /** - * @tc.number:TEST_GET_001 - * @tc.name: testGet001 - * @tc.desc: Gets the element corresponding to the specified index. For example: linkedList.get(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.get(1); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number:TEST_GET_002 - * @tc.name: testGet002 - * @tc.desc: Gets the element corresponding to the specified index. For example: linkedList.get(10). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.get(10); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number:TEST_GET_003 - * @tc.name: testGet003 - * @tc.desc: Gets the element corresponding to the specified index. For example: linkedList.get(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet003", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.get(1); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number:TEST_GET_004 - * @tc.name: testGet004 - * @tc.desc: Gets the element corresponding to the specified index. For example: linkedList.get("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGet004", 0, function () { - let linkedList = new LinkedList(); - try { - //@ts-ignore - linkedList.get("a"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number:TEST_ADDFIRST_001 - * @tc.name: testAddFirst001 - * @tc.desc: Add element to LinkedList instance header. For example: linkedList.addFirst("e"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAddFirst001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("e"); - let res = linkedList.get(0); - expect(res).assertEqual("e"); - }); - - /** - * @tc.number:TEST_ADDFIRST_002 - * @tc.name: testAddFirst002 - * @tc.desc: Add element to LinkedList instance header. For example: linkedList.addFirst("h"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAddFirst002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("h"); - let res = linkedList.get(0); - expect(res).assertEqual("h"); - }); - - /** - * @tc.number:TEST_ADDFIRST_003 - * @tc.name: testAddFirst003 - * @tc.desc: Add element to LinkedList instance header. For example: linkedList.addFirst("m"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAddFirst003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("m"); - let res = linkedList.get(0); - expect(res).assertEqual("m"); - }); - - /** - * @tc.number:TEST_ADDFIRST_004 - * @tc.name: testAddFirst004 - * @tc.desc: Add element to LinkedList instance header. For example: linkedList.addFirst("k"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAddFirst004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("k"); - let res = linkedList.get(0); - expect(res).assertEqual("k"); - }); - - /** - * @tc.number:TEST_ADDFIRST_005 - * @tc.name: testAddFirst005 - * @tc.desc: Add element to LinkedList instance header. For example: linkedList.addFirst("w"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testAddFirst005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("w"); - let res = linkedList.get(0); - expect(res).assertEqual("w"); - }); - - /** - * @tc.number:TEST_REMOVEFIRST_001 - * @tc.name: testRemoveFirst001 - * @tc.desc: Delete the header element of a LinkedList instance. For example: linkedList.removeFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirst001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - let res = linkedList.removeFirst(); - expect(res).assertEqual("a"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRST_002 - * @tc.name: testRemoveFirst002 - * @tc.desc: Delete the header element of a LinkedList instance. For example: linkedList.removeFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirst002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("m"); - linkedList.add("b"); - linkedList.add("c"); - let res = linkedList.removeFirst(); - expect(res).assertEqual("m"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRST_003 - * @tc.name: testRemoveFirst003 - * @tc.desc: Delete the header element of a LinkedList instance. For example: linkedList.removeFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirst003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("h"); - linkedList.add("b"); - linkedList.add("c"); - let res = linkedList.removeFirst(); - expect(res).assertEqual("h"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRST_004 - * @tc.name: testRemoveFirst004 - * @tc.desc: Delete the header element of a LinkedList instance. For example: linkedList.removeFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirst004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("k"); - linkedList.add("b"); - linkedList.add("c"); - let res = linkedList.removeFirst(); - expect(res).assertEqual("k"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRST_005 - * @tc.name: testRemoveFirst005 - * @tc.desc: Delete the header element of a LinkedList instance. For example: linkedList.removeFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirst005", 0, function () { - let linkedList = new LinkedList(); - try { - linkedList.removeFirst(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200010); - expect(err.message).assertEqual(`Container is empty`); - } - }); - - /** - * @tc.number:TEST_REMOVELAST_001 - * @tc.name: testRemoveLast001 - * @tc.desc: Delete the end element of a LinkedList instance. linkedList.removeLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLast001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("c"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELAST_002 - * @tc.name: testRemoveLast002 - * @tc.desc: Delete the end element of a LinkedList instance. linkedList.removeLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLast002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("d"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("d"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", "a", "b","c"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELAST_003 - * @tc.name: testRemoveLast003 - * @tc.desc: Delete the end element of a LinkedList instance. linkedList.removeLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLast003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("h"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("h"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELAST_004 - * @tc.name: testRemoveLast004 - * @tc.desc: Delete the end element of a LinkedList instance. linkedList.removeLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLast004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("m"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("m"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELAST_005 - * @tc.name: testRemoveLast005 - * @tc.desc: Delete the end element of a LinkedList instance. linkedList.removeLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLast061", 0, function () { - let linkedList = new LinkedList(); - try { - linkedList.removeLast(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200010); - expect(err.message).assertEqual(`Container is empty`); - } - }); - - /** - * @tc.number:TEST_HAS_001 - * @tc.name: testHas001 - * @tc.desc: Check whether the LinkedList contains a specified element. For example: linkedList.has("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHas001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - let res = linkedList.has("a"); - expect(res).assertEqual(true); - let res1 = linkedList.has("d"); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number:TEST_HAS_002 - * @tc.name: testHas002 - * @tc.desc: Check whether the LinkedList contains a specified element. For example: linkedList.has("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHas002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("m"); - let res = linkedList.has("m"); - expect(res).assertEqual(true); - let res1 = linkedList.has("k"); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number:TEST_HAS_003 - * @tc.name: testHas003 - * @tc.desc: Check whether the LinkedList contains a specified element. For example: linkedList.has(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testHas003", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.has(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number:TEST_GETINDEXOF_001 - * @tc.name: testGetIndexOf001 - * @tc.desc: In the LinkedList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getIndexOf("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOf001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getIndexOf("b"); - expect(res).assertEqual(1); - }); - - /** - * @tc.number:TEST_GETINDEXOF_002 - * @tc.name: testGetIndexOf002 - * @tc.desc: In the LinkedList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getIndexOf("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOf002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getIndexOf("a"); - expect(res).assertEqual(0); - }); - - /** - * @tc.number:TEST_GETINDEXOF_003 - * @tc.name: testGetIndexOf003 - * @tc.desc: In the LinkedList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getIndexOf("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOf003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getIndexOf("c"); - expect(res).assertEqual(2); - }); - - /** - * @tc.number:TEST_GETINDEXOF_004 - * @tc.name: testGetIndexOf004 - * @tc.desc: In the LinkedList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getIndexOf("f"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOf004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getIndexOf("f"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number:TEST_GETINDEXOF_005 - * @tc.name: testGetIndexOf005 - * @tc.desc: In the LinkedList instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. For example: linkedList.getIndexOf(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetIndexOf005", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.getIndexOf(1); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number:TEST_REMOVEBYINDEX_001 - * @tc.name: testRemoveByIndex001 - * @tc.desc: In the linkedList instance, delete the element based on its index. - * For example: linkedList.removeByIndex(2). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveByIndex001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeByIndex(2); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEBYINDEX_002 - * @tc.name: testRemoveByIndex002 - * @tc.desc: In the linkedList instance, delete the element based on its index. - * For example: linkedList.removeByIndex(3). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveByIndex002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeByIndex(3); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEBYINDEX_003 - * @tc.name: testRemoveByIndex003 - * @tc.desc: In the linkedList instance, delete the element based on its subscript index. - * For example: linkedList.removeByIndex(10). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveByIndex003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - try { - let res = linkedList.removeByIndex(10); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 10`); - } - }); - - /** - * @tc.number:TEST_REMOVEBYINDEX_004 - * @tc.name: testRemoveByIndex004 - * @tc.desc: In the linkedList instance, delete the element based on its subscript index. - * For example: linkedList.removeByIndex(1). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveByIndex004", 0, function () { - let linkedList = new LinkedList(); - try { - let res = linkedList.removeByIndex(1); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 0. Received value is: 1`); - } - }); - - /** - * @tc.number:TEST_REMOVEBYINDEX_005 - * @tc.name: testRemoveByIndex005 - * @tc.desc: In the linkedList instance, delete the element based on its subscript index. - * For example: linkedList.removeByIndex("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveByIndex005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - try { - //@ts-ignore - linkedList.removeByIndex("a"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number:TEST_REMOVE_001 - * @tc.name: testRemove001 - * @tc.desc: Delete the specified element. For example: linkedList.remove("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.remove("a"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVE_002 - * @tc.name: testRemove002 - * @tc.desc: Delete the specified element. For example: linkedList.remove("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.remove("c"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVE_003 - * @tc.name: testRemove003 - * @tc.desc: Delete the specified element. For example: linkedList.remove("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.remove("b"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVE_004 - * @tc.name: testRemove004 - * @tc.desc: Delete the specified element. For example: linkedList.remove("d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.remove("d"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number:TEST_REMOVE_005 - * @tc.name: testRemove005 - * @tc.desc: Delete the specified element. For example: linkedList.remove("d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemove005", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.remove("d"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number:TEST_REMOVEFIRSTFOUND_001 - * @tc.name: testRemoveFirstFound001 - * @tc.desc: Delete the specified element found for the first time. For example: linkedList.removeFirstFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirstFound001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeFirstFound("b"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRSTFOUND_002 - * @tc.name: testRemoveFirstFound002 - * @tc.desc: Delete the specified element found for the first time. For example: linkedList.removeFirstFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirstFound002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeFirstFound("a"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRSTFOUND_003 - * @tc.name: testRemoveFirstFound003 - * @tc.desc: Delete the specified element found for the first time. For example: linkedList.removeFirstFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirstFound003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeFirstFound("c"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRSTFOUND_004 - * @tc.name: testRemoveFirstFound004 - * @tc.desc: Delete the specified element found for the first time. For example: linkedList.removeFirstFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirstFound004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("m"); - let res = linkedList.removeFirstFound("m"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "a"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVEFIRSTFOUND_005 - * @tc.name: testRemoveFirstFound005 - * @tc.desc: Delete the specified element found for the first time. For example: linkedList.removeFirstFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveFirstFound005", 0, function () { - let linkedList = new LinkedList(); - try { - linkedList.removeFirstFound("b"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200010); - expect(err.message).assertEqual(`Container is empty`); - } - }); - - /** - * @tc.number:TEST_REMOVELASTFOUND_001 - * @tc.name: testRemoveLastFound001 - * @tc.desc: Delete the specified element found for the last time. For example: linkedList.removeLastFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLastFound001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeLastFound("b"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "a"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELASTFOUND_002 - * @tc.name: testRemoveLastFound002 - * @tc.desc: Delete the specified element found for the last time. For example: linkedList.removeLastFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLastFound002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeLastFound("a"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELASTFOUND_003 - * @tc.name: testRemoveLastFound003 - * @tc.desc: Delete the specified element found for the last time. For example: linkedList.removeLastFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLastFound003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.removeLastFound("c"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELASTFOUND_004 - * @tc.name: testRemoveLastFound004 - * @tc.desc: Delete the specified element found for the last time. For example: linkedList.removeLastFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLastFound004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("m"); - let res = linkedList.removeLastFound("m"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b","c","a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_REMOVELASTFOUND_005 - * @tc.name: testRemoveLastFound005 - * @tc.desc: Delete the specified element found for the last time. For example: linkedList.removeLastFound("b"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testRemoveLastFound005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("m"); - let res = linkedList.removeLastFound("a"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b","c","b", "m"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_GETLASTINDEXOF_001 - * @tc.name: testGetLastIndexOf001 - * @tc.desc: In the LinkedList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getLastIndexOf("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLastIndexOf001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getLastIndexOf("a"); - expect(res).assertEqual(3); - }); - - /** - * @tc.number:TEST_GETLASTINDEXOF_002 - * @tc.name: testGetLastIndexOf002 - * @tc.desc: In the LinkedList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getLastIndexOf("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLastIndexOf002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getLastIndexOf("b"); - expect(res).assertEqual(5); - }); - - /** - * @tc.number:TEST_GETLASTINDEXOF_003 - * @tc.name: testGetLastIndexOf003 - * @tc.desc: In the LinkedList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getLastIndexOf("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLastIndexOf003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getLastIndexOf("c"); - expect(res).assertEqual(2); - }); - - /** - * @tc.number:TEST_GETLASTINDEXOF_004 - * @tc.name: testGetLastIndexOf004 - * @tc.desc: In the LinkedList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getLastIndexOf("a"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLastIndexOf004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("k"); - linkedList.add("b"); - linkedList.add("k"); - linkedList.add("b"); - let res = linkedList.getLastIndexOf("k"); - expect(res).assertEqual(6); - }); - - /** - * @tc.number:TEST_GETLASTINDEXOF_005 - * @tc.name: testGetLastIndexOf005 - * @tc.desc: In the LinkedList instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. - * For example: linkedList.getLastIndexOf("f"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLastIndexOf005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("b"); - let res = linkedList.getLastIndexOf("f"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number:TEST_GETFIRST_001 - * @tc.name: testGetFirst001 - * @tc.desc: Get the header element of the linkedList instance. For example: linkedList.getFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetFirst001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.getFirst(); - expect(res).assertEqual("a"); - }); - - /** - * @tc.number:TEST_GETFIRST_002 - * @tc.name: testGetFirst002 - * @tc.desc: Get the header element of the linkedList instance. For example: linkedList.getFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetFirst002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("m"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.getFirst(); - expect(res).assertEqual("m"); - }); - - /** - * @tc.number:TEST_GETFIRST_003 - * @tc.name: testGetFirst003 - * @tc.desc: Get the header element of the linkedList instance. For example: linkedList.getFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetFirst003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("k"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.getFirst(); - expect(res).assertEqual("k"); - }); - - /** - * @tc.number:TEST_GETFIRST_004 - * @tc.name: testGetFirst004 - * @tc.desc: Get the header element of the linkedList instance. For example: linkedList.getFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetFirst004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("h"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.getFirst(); - expect(res).assertEqual("h"); - }); - - /** - * @tc.number:TEST_GETFIRST_005 - * @tc.name: testGetFirst005 - * @tc.desc: Get the header element of the linkedList instance. For example: linkedList.getFirst(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetFirst005", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number:TEST_GETLAST_001 - * @tc.name: testGetLast001 - * @tc.desc: Get the end element of the linkedList instance. For example: linkedList.getLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLast001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("b"); - let res = linkedList.getLast(); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number:TEST_GETLAST_002 - * @tc.name: testGetLast002 - * @tc.desc: Get the end element of the linkedList instance. For example: linkedList.getLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLast002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("m"); - let res = linkedList.getLast(); - expect(res).assertEqual("m"); - }); - - /** - * @tc.number:TEST_GETLAST_003 - * @tc.name: testGetLast003 - * @tc.desc: Get the end element of the linkedList instance. For example: linkedList.getLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLast003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("h"); - let res = linkedList.getLast(); - expect(res).assertEqual("h"); - }); - - /** - * @tc.number:TEST_GETLAST_004 - * @tc.name: testGetLast004 - * @tc.desc: Get the end element of the linkedList instance. For example: linkedList.getLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLast004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - linkedList.add("k"); - let res = linkedList.getLast(); - expect(res).assertEqual("k"); - }); - - /** - * @tc.number:TEST_GETLAST_005 - * @tc.name: testGetLast005 - * @tc.desc: Get the end element of the linkedList instance. For example: linkedList.getLast(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testGetLast005", 0, function () { - let linkedList = new LinkedList(); - let res = linkedList.getLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number:TEST_SET_001 - * @tc.name: testSet001 - * @tc.desc: Modify the element corresponding to the specified index. For example: linkedList.set(2, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - let res = linkedList.set(2, "d"); - let res1 = linkedList.get(2); - expect(res1).assertEqual("d"); - }); - - /** - * @tc.number:TEST_SET_002 - * @tc.name: testSet002 - * @tc.desc: Modify the element corresponding to the specified index. For example: linkedList.set(2, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - let res = linkedList.set(1, "m"); - let res1 = linkedList.get(1); - expect(res1).assertEqual("m"); - }); - - /** - * @tc.number:TEST_SET_003 - * @tc.name: testSet003 - * @tc.desc: Modify the element corresponding to the specified index. For example: linkedList.set(2, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - let res = linkedList.set(3, "k"); - let res1 = linkedList.get(3); - expect(res1).assertEqual("k"); - }); - - /** - * @tc.number:TEST_SET_004 - * @tc.name: testSet004 - * @tc.desc: Modify the element corresponding to the specified index. For example: linkedList.set(6, "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("a"); - try { - linkedList.set(6, "d"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 3. Received value is: 6`); - } - }); - - /** - * @tc.number:TEST_SET_005 - * @tc.name: testSet005 - * @tc.desc: Modify the element corresponding to the specified index. For example: linkedList.set("a", "d"). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testSet005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - try { - //@ts-ignore - linkedList.set("a", "d"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "index" must be number. Received value is: a`); - } - }); - - /** - * @tc.number:TEST_FOREACH_001 - * @tc.name: testForEach001 - * @tc.desc: Traversing elements in an LinkedList instance. - * For example: linkedList.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(8); - linkedList.add("一"); - linkedList.add("二"); - linkedList.add(5); - let c = [1, 2, 3, 4]; - linkedList.add(c); - linkedList.add(6); - linkedList.add("三"); - linkedList.add("四"); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = [8, "一", "二", 5, c, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_FOREACH_002 - * @tc.name: testForEach002 - * @tc.desc: Traversing elements in an LinkedList instance. - * For example: linkedList.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(8); - linkedList.add(1); - linkedList.add(2); - linkedList.add(5); - let c = [1, 2, 3, 4]; - linkedList.add(c); - linkedList.add(6); - linkedList.add(3); - linkedList.add(4); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = [8, 1, 2, 5, c, 6, 3, 4]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_FOREACH_003 - * @tc.name: testForEach003 - * @tc.desc: Traversing elements in an LinkedList instance. - * For example: linkedList.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(8); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - let c = [1, 2, 3, 4]; - linkedList.add("c"); - linkedList.add(6); - linkedList.add(3); - linkedList.add(4); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = [8, "a", "b", "c", "c", 6, 3, 4]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_FOREACH_004 - * @tc.name: testForEach004 - * @tc.desc: Traversing elements in an LinkedList instance. - * For example: linkedList.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("m"); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - let c = [1, 2, 3, 4]; - linkedList.add("m"); - linkedList.add(6); - linkedList.add(3); - linkedList.add(4); - let arr = []; - linkedList.forEach((item, index) => { - arr.push(item); - }); - let a = ["m", "a", "b", "c", "m", 6, 3, 4]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_FOREACH_005 - * @tc.name: testForEach005 - * @tc.desc: Traversing elements in an LinkedList instance. - * For example: linkedList.forEach((item, index) => { num++; }). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testForEach005", 0, function () { - let linkedList = new LinkedList(); - let num = 0; - linkedList.forEach((item, index) => { - num++; - }); - expect(num).assertEqual(0); - }); - - /** - * @tc.number:TEST_CLEAR_001 - * @tc.name: testClear001 - * @tc.desc: Clear all elements in the linkedList instance. For example: linkedList.clear(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClear001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(4); - linkedList.add(3); - linkedList.add(1); - linkedList.add(2); - linkedList.add(14); - linkedList.clear(); - let res = linkedList.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number:TEST_CLEAR_002 - * @tc.name: testClear002 - * @tc.desc: Clear all elements in the linkedList instance. For example: linkedList.clear(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClear002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("d"); - linkedList.add(20); - linkedList.clear(); - let res = linkedList.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number:TEST_CLEAR_003 - * @tc.name: testClear003 - * @tc.desc: Clear all elements in the LinkedList instance. For example: linkedList.clear(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClear003", 0, function () { - let linkedList = new LinkedList(); - linkedList.clear(); - const len = linkedList.length; - expect(len).assertEqual(0); - }); - - /** - * @tc.number:TEST_CLONE_001 - * @tc.name: testClone001 - * @tc.desc: Clone an LinkedList instance. For example: linkedList.clone(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClone001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - let linkedList1 = linkedList.clone(); - linkedList1.addFirst("e"); - let res = linkedList1.removeLast(); - expect(res).assertEqual("c"); - let arr = []; - linkedList1.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CLONE_002 - * @tc.name: testClone002 - * @tc.desc: Clone an LinkedList instance. For example: linkedList.clone(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClone002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(1); - linkedList.add(2); - linkedList.add(3); - let linkedList1 = linkedList.clone(); - linkedList1.addFirst("e"); - let res = linkedList1.removeLast(); - expect(res).assertEqual(3); - let arr = []; - linkedList1.forEach((item, index) => { - arr.push(item); - }); - let a = ["e", 1, 2]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CLONE_003 - * @tc.name: testClone003 - * @tc.desc: Clone an LinkedList instance. For example: linkedList.clone(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testClone003", 0, function () { - let linkedList = new LinkedList(); - let newlinkedList = linkedList.clone(); - let res = true - for (let i = 0; i < linkedList.length; i++) { - if (linkedList[i] !== newlinkedList[i]) { - res = false - } - } - expect(res).assertEqual(true); - }); - - /** - * @tc.number:TEST_CONVERTTOARRAY_001 - * @tc.name: testConvertToArray001 - * @tc.desc: Convert an LinkedList instance to an array. For example: linkedList.convertToArray(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConvertToArray001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(4); - linkedList.add(3); - linkedList.add(1); - linkedList.add(2); - linkedList.add(14); - let res = linkedList.convertToArray(); - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CONVERTTOARRAY_002 - * @tc.name: testConvertToArray002 - * @tc.desc: Convert an LinkedList instance to an array. For example: linkedList.convertToArray(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConvertToArray002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(1); - linkedList.add(2); - linkedList.add(3); - linkedList.add(4); - linkedList.add(5); - linkedList.add(6); - let res = linkedList.convertToArray(); - let a = [1,2,3,4,5,6]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CONVERTTOARRAY_003 - * @tc.name: testConvertToArray003 - * @tc.desc: Convert an LinkedList instance to an array. For example: linkedList.convertToArray(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConvertToArray003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(2); - linkedList.add(4); - linkedList.add(3); - linkedList.add(10); - linkedList.add(12); - linkedList.add(16); - let res = linkedList.convertToArray(); - let a = [2,4,3,10,12,16]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CONVERTTOARRAY_004 - * @tc.name: testConvertToArray004 - * @tc.desc: Convert an LinkedList instance to an array. For example: linkedList.convertToArray(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConvertToArray004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.add("d"); - linkedList.add("e"); - linkedList.add("f"); - let res = linkedList.convertToArray(); - let a = ["a","b","c","d","e","f"]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_CONVERTTOARRAY_005 - * @tc.name: testConvertToArray005 - * @tc.desc: Convert an LinkedList instance to an array. For example: linkedList.convertToArray(). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testConvertToArray005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("m"); - linkedList.add("k"); - linkedList.add("c"); - linkedList.add("d"); - linkedList.add("e"); - linkedList.add("f"); - let res = linkedList.convertToArray(); - let a = ["m","k","c","d","e","f"]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_ITERATOR_001 - * @tc.name: testIterator001 - * @tc.desc: Iterates over all elements in an LinkedList instance. For example: linkedList[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator001", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(1); - linkedList.add(2); - linkedList.add(3); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual(3); - let arr = []; - let itr = linkedList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["e", 1, 2]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_ITERATOR_002 - * @tc.name: testIterator002 - * @tc.desc: Iterates over all elements in an LinkedList instance. For example: linkedList[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator002", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(5); - linkedList.add(10); - linkedList.add(15); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual(15); - let arr = []; - let itr = linkedList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["e", 5, 10]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_ITERATOR_003 - * @tc.name: testIterator003 - * @tc.desc: Iterates over all elements in an LinkedList instance. For example: linkedList[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator003", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("k"); - linkedList.add("h"); - linkedList.add("m"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("m"); - let arr = []; - let itr = linkedList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["e", "k", "h"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_ITERATOR_004 - * @tc.name: testIterator004 - * @tc.desc: Iterates over all elements in an LinkedList instance. For example: linkedList[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator004", 0, function () { - let linkedList = new LinkedList(); - linkedList.add(1); - linkedList.add(2); - linkedList.add(3); - linkedList.addFirst(10); - let res = linkedList.removeLast(); - expect(res).assertEqual(3); - let arr = []; - let itr = linkedList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = [10, 1, 2]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number:TEST_ITERATOR_005 - * @tc.name: testIterator005 - * @tc.desc: Iterates over all elements in an LinkedList instance. For example: linkedList[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it("testIterator005", 0, function () { - let linkedList = new LinkedList(); - linkedList.add("a"); - linkedList.add("b"); - linkedList.add("c"); - linkedList.addFirst("e"); - let res = linkedList.removeLast(); - expect(res).assertEqual("c"); - let arr = []; - let itr = linkedList[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["e", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - }); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 6222ba326f931516d6699389ce2cbf296c5cdc1d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import LinkedListTest from './LinkedList.test' - -export default function testsuite() { - LinkedListTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryLinkedListetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/app.json deleted file mode 100755 index c75cf6ef560072e2025c6bb3679b17448d7aa974..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.List2.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryListetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryListetstest/BUILD.gn deleted file mode 100755 index 115f312947631311cc34ad61a46c7ccde54275d4..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossPlatformList2Test") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossPlatformList2Test" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/Test.json b/commonlibrary/crossplatform/commonlibraryListetstest/Test.json deleted file mode 100755 index 777f6e7d1dd03c734fa7eddd9dab7ce1138d3526..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.List2.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossPlatformList2Test.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryListetstest/signature/openharmony_sx.p7b deleted file mode 100755 index 0ab06562d29095c0420f3e0e1e6c5b5dd3071b1e..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryListetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index cb027d69256099790b95a32b446978bbc64b4ecb..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 8cbc4b3b96d8d38bc36fbd9a3173d3fd4f09db73..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 62981d246b63eb383fc4c6486e29847eb782938d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2023 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. - */ -import ListTest from './List2.test' - -export default function testsuite() { - ListTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List2.test.ets b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List2.test.ets deleted file mode 100755 index 5f018af8ca3618cb5078cc1d3d91ac3cb6a4a97a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/ets/test/List2.test.ets +++ /dev/null @@ -1,1271 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import List from "@ohos.util.List"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function ListTest() { - describe("ListTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an List instance. For example: let list = new List(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - try { - let list = new List(); - expect(list != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The List's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of elements contained in the List instance. For example: list.length. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 1 - */ - it("testLength001", 0, function () { - let list = new List(); - list.add(4); - list.add(3); - list.add(1); - list.add(2); - list.add(14); - let res = list.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add a element to the end of the List instance. For example: list.add(8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let list = new List(); - list.add(8); - let res = list.get(0); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add a element to the end of the List instance. - * For example: let a = [1, 2, 3, 4]; list.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let list = new List(); - let a = [1, 2, 3, 4]; - list.add(a); - let res = list.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add a element to the end of the List instance. - * For example: let a = {name: "lala", age: "13"}; list.add(a). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let list = new List(); - let a = {name: "lala", age: "13"}; - list.add(a); - let res = list.get(0); - expect(res).assertEqual(a); - }); - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add a element to the end of the List instance. For example: list.add("*"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let list = new List(); - list.add("."); - list.add("*"); - list.add("|"); - let res = list.get(0); - expect(res).assertEqual("."); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add a element to the end of the List instance. For example: list.add("*"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let list = new List(); - list.add("."); - list.add("*"); - list.add("|"); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = [".", "*", "|"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add a element to the end of the List instance. For example: list.add(" "). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let list = new List(); - list.add(" "); - let res = list.get(0); - expect(res).assertEqual(" "); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add a element to the end of the List instance. For example: list.add("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let list = new List(); - list.add("a"); - list.add("a"); - let res = list.get(0); - let res1 = list.get(1); - expect(res).assertEqual("a"); - expect(res1).assertEqual("a"); - }); - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add a element to the end of the List instance. For example: for (let i = 0; i < 100; i++) {list.add(i);}. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let list = new List(); - for (let i = 0; i < 100; i++) { - list.add(i); - } - let res = list.get(99); - let res1 = list.length; - expect(res).assertEqual(99); - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add a element to the end of the List instance. For example: list.add(null). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let list = new List(); - list.add(null); - let res = list.get(0); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add a element to the end of the List instance. For example: list.add(0.1111). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let list = new List(); - list.add(0.1111); - let res = list.get(0); - expect(res).assertEqual(0.1111); - }); - - /** - * @tc.number: TEST_ADD_011 - * @tc.name : testAdd011 - * @tc.desc : Add a element to the end of the List instance. For example: list.add(-1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd011", 0, function () { - let list = new List(); - list.add(-1); - let res = list.get(0); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_ADD_012 - * @tc.name : testAdd012 - * @tc.desc : Add a element to the end of the List instance. For example: const obj = {}; list.add(obj). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd012", 0, function () { - let list = new List(); - const obj = {}; - list.add(obj); - let res = list.get(0); - expect(res).assertEqual(obj); - }); - - /** - * @tc.number: TEST_ADD_013 - * @tc.name : testAdd013 - * @tc.desc : Add a element to the end of the List instance. For example: list.add.bind({}, "a")(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testAdd013', 0, function () { - let list = new List(); - try { - list.add.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_INSERT_001 - * @tc.name : testInsert001 - * @tc.desc : Insert an element into the middle of the List instance. For example: list.insert("d", 3). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.insert("d", 3); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "c", "d", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_INSERT_002 - * @tc.name : testInsert002 - * @tc.desc : Insert an element into the middle of the List instance. For example: list.insert("d", 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsert002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - try { - let res = list.insert("d", 8); - expect(true).assertEqual(false); - } catch(err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 5. Received value is: 8`); - } - }); - - /** - * @tc.number: TEST_GET_001 - * @tc.name : testGet001 - * @tc.desc : Gets the element corresponding to the specified index. For example: list.get(0). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet001", 0, function () { - let list = new List(); - list.add("四"); - let res = list.get(0); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number: TEST_GET_002 - * @tc.name : testGet002 - * @tc.desc : Gets the element corresponding to the specified index. For example: list.get(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.add("b"); - let res = list.get(2); - expect(res).assertEqual("c"); - }); - - /** - * @tc.number: TEST_GET_003 - * @tc.name : testGet003 - * @tc.desc : Gets the element corresponding to the specified index. For example: list.get(6). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet003", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.add("b"); - let res = list.get(6); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_004 - * @tc.name : testGet004 - * @tc.desc : Gets the element corresponding to the specified index. For example: list.get(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet004", 0, function () { - let list = new List(); - let res = list.get(1); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_005 - * @tc.name : testGet005 - * @tc.desc : Gets the element corresponding to the specified index. For example: list.get.bind({}, 1)(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet005", 0, function () { - let list = new List(); - try { - list.get.bind({}, 1)(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The get method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Check whether the List contains a specified element. For example: list.has("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - let res = list.has("a"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_002 - * @tc.name : testHas002 - * @tc.desc : Check whether the List contains a specified element. For example: list.has("d"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - let res = list.has("d"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_003 - * @tc.name : testHas003 - * @tc.desc : Check whether the List contains a specified element. For example: list.has(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas003", 0, function () { - let list = new List(); - let res = list.has(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_001 - * @tc.name : testGetIndexOf001 - * @tc.desc : In the List instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. For example: list.getIndexOf("b"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOf001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.add("b"); - let res = list.getIndexOf("b"); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_002 - * @tc.name : testGetIndexOf002 - * @tc.desc : In the List instance, find the index of a specified element from front to back, - * and return the index found for the first time. If not found, return -1. For example: list.getIndexOf("b"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOf002", 0, function () { - let list = new List(); - let res = list.getIndexOf(1); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_001 - * @tc.name : testRemoveByIndex001 - * @tc.desc : In the List instance, delete the element based on its index. For example: list.removeByIndex(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByIndex001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.removeByIndex(2); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_002 - * @tc.name : testRemoveByIndex002 - * @tc.desc : In the List instance, delete the element based on its index. For example: list.removeByIndex(5). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByIndex002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - try { - let res = list.removeByIndex(5); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 5`); - } - }); - - /** - * @tc.number: TEST_REMOVE_BY_INDEX_003 - * @tc.name : testRemoveByIndex003 - * @tc.desc : In the List instance, delete the element based on its index. For example: list.removeByIndex(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveByIndex003", 0, function () { - let list = new List(); - try { - let res = list.removeByIndex(1); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 0. Received value is: 1`); - } - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete the specified element. For example: list.remove("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - let res = list.remove("a"); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = ["b", "c", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_GET_LAST_INDEX_OF_001 - * @tc.name : testGetLastIndexOf001 - * @tc.desc : In the List instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. For example: list.getLastIndexOf("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastIndexOf001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.add("b"); - let res = list.getLastIndexOf("a"); - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_GET_LAST_INDEX_OF_002 - * @tc.name : testGetLastIndexOf002 - * @tc.desc : In the List instance, find the index of a specified element from brack to front, - * and return the index found for the first time. If not found, return -1. For example: list.getLastIndexOf("F"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastIndexOf002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.add("b"); - let res = list.getLastIndexOf("F"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_GET_FIRST_001 - * @tc.name : testGetFirst001 - * @tc.desc : Get the header element of the List instance. For example: list.getFirst(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirst001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - let res = list.getFirst(); - expect(res).assertEqual("a"); - }); - - /** - * @tc.number: TEST_GET_FIRST_001 - * @tc.name : testGetFirst001 - * @tc.desc : Get the header element of the List instance. For example: list.getFirst(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirst002", 0, function () { - let list = new List(); - let res = list.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_LAST_001 - * @tc.name : testGetLast001 - * @tc.desc : Get the end element of the List instance. For example: list.getLast(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLast001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - let res = list.getLast(); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number: TEST_GET_LAST_001 - * @tc.name : testGetLast001 - * @tc.desc : Get the end element of the List instance. For example: list.getLast(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLast002", 0, function () { - let list = new List(); - let res = list.getLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_SET_001 - * @tc.name : testSet001 - * @tc.desc : Modify the element corresponding to the specified index. For example: list.set(2, "d"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.set(2, "d"); - let res1 = list.get(2); - expect(res1).assertEqual("d"); - }); - - /** - * @tc.number: TEST_SET_002 - * @tc.name : testSet002 - * @tc.desc : Modify the element corresponding to the specified index. For example: list.set(6, "d"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet002", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - try { - list.set(6, "d"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 2. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_EQUAL_001 - * @tc.name : testEqual001 - * @tc.desc : Judge whether two List instances are equal. For example: let res = list.equal(list1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual001", 0, function () { - let list = new List(); - let list1 = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list1.add("a"); - list1.add("b"); - list1.add("d"); - let res = list.equal(list1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUAL_002 - * @tc.name : testEqual002 - * @tc.desc : Judge whether two List instances are equal. For example: let res = list.equal(list1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual002", 0, function () { - let list = new List(); - let list1 = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list1.add("a"); - list1.add("b"); - list1.add("c"); - let res = list.equal(list1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUAL_003 - * @tc.name : testEqual003 - * @tc.desc : Judge whether two List instances are equal. For example: let res = list.equal(list1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual003", 0, function () { - let list = new List(); - let list1 = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list1.add("a"); - list1.add("b"); - let res = list.equal(list1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUAL_004 - * @tc.name : testEqual004 - * @tc.desc : Judge whether two List instances are equal. For example: let res = list.equal(list1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqual004", 0, function () { - let list = new List(); - let list1 = new List(); - let res = list.equal(list1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traversing elements in an List instance. For example: list.forEach((item, index) => {arr.push(item);}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let list = new List(); - let c = [1, 2, 3, 4]; - list.add(8); - list.add("一"); - list.add("二"); - list.add(5); - list.add(c); - list.add(6); - list.add("三"); - list.add("四"); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = [8, "一", "二", 5, c, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traversing elements in an List instance. For example: list.forEach((item, index) => {num++;}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach002", 0, function () { - let list = new List(); - let num = 0; - list.forEach((item, index) => { - num++; - }); - expect(num).assertEqual(0); - }); - - /** - * @tc.number: TEST_FOR_EACH_003 - * @tc.name : testForEach003 - * @tc.desc : Traversing elements in an List instance. For example: list.forEach.bind({}, "a")(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testForEach003', 0, function () { - let list = new List(); - try { - list.forEach.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The forEach method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_SORT_001 - * @tc.name : testSort001 - * @tc.desc : Arrange the elements in the List instance in descending order. For example: list.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort001", 0, function () { - let list = new List(); - list.add(4); - list.add(3); - list.add(1); - list.add(2); - list.add(14); - list.sort((a:any, b:any) => a - b); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = [1, 2, 3, 4, 14]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SORT_002 - * @tc.name : testSort002 - * @tc.desc : Arrange the elements in the List instance in descending order. For example: list.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort002", 0, function () { - let list = new List(); - list.add(";"); - list.add("一"); - list.add("a"); - list.add("1"); - list.add("2"); - list.add("14"); - list.sort((a:any, b:any) => a - b); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = [";", "一", "a", "1", "2", "14"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_SORT_003 - * @tc.name : testSort003 - * @tc.desc : Arrange the elements in the List instance in descending order. For example: list.sort((a, b) => a - b). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSort003", 0, function () { - let list = new List(); - list.sort((a:any, b:any) => a - b); - let res1 = list.length; - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all elements in the List instance. For example: list.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.clear(); - let res = list.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all elements in the List instance. For example: list.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let list = new List(); - list.clear(); - let res1 = list.length; - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_GET_SUBLIST_001 - * @tc.name : testGetSubList001 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: list.getSubList(2, 4). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetSubList001", 0, function () { - let list = new List(); - list.add(4); - list.add(3); - list.add(1); - list.add(2); - list.add(14); - let res = list.getSubList(2, 4); - let arr = []; - res.forEach((item, index) => { - arr.push(item); - }); - let a = [1, 2]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_GET_SUBLIST_002 - * @tc.name : testGetSubList002 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: list.getSubList(2, 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetSubList002", 0, function () { - let list = new List(); - list.add("4"); - list.add("3"); - list.add("1"); - list.add("2"); - list.add("14"); - try { - list.getSubList(2, 8); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "toIndex" is out of range. It must be >= 0 && <= 5. Received value is: 8`); - } - }); - - /** - * @tc.number: TEST_GET_SUBLIST_003 - * @tc.name : testGetSubList003 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: list.getSubList(6, 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetSubList003", 0, function () { - let list = new List(); - list.add("4"); - list.add("3"); - list.add("1"); - list.add("2"); - list.add("14"); - try { - list.getSubList(6, 8); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 4. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_GET_SUBLIST_004 - * @tc.name : testGetSubList004 - * @tc.desc : Intercepts an element within the specified range, including the element with the - * starting index but not the element with the ending index. For example: list.getSubList(6, 2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetSubList004", 0, function () { - let list = new List(); - list.add("4"); - list.add("3"); - list.add("1"); - list.add("2"); - list.add("14"); - try { - list.getSubList(6, 2); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "fromIndex" is out of range. It must be >= 0 && <= 1. Received value is: 6`); - } - }); - - /** - * @tc.number: TEST_REPLACE_ALL_ELEMENTS_001 - * @tc.name : testReplaceAllElements001 - * @tc.desc : Perform some operation on the elements in the List instance and return the List instance - * after the operation. For example: list.replaceAllElements((item, index) => {return (item = 2 * item);}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplaceAllElements001", 0, function () { - let list = new List(); - list.add(1); - list.add(2); - list.add(4); - list.add(5); - list.replaceAllElements((item:number, index) => { - return (item = 2 * item); - }); - let arr = []; - list.forEach((item, index) => { - arr.push(item); - }); - let a = [2, 4, 8, 10]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_REPLACE_ALL_ELEMENTS_002 - * @tc.name : testReplaceAllElements002 - * @tc.desc : Perform some operation on the elements in the List instance and return the List instance - * after the operation. For example: list.replaceAllElements((item, index) => {num++;}). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplaceAllElements002", 0, function () { - let list = new List(); - let num = 0; - list.replaceAllElements((item, index) => { - num++; - }); - expect(num).assertEqual(0); - }); - - /** - * @tc.number: TEST_CONVERT_TO_ARRAY_001 - * @tc.name : testConvertToArray001 - * @tc.desc : Convert an List instance to an array. For example: list.convertToArray(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertToArray001", 0, function () { - let list = new List(); - list.add(4); - list.add(3); - list.add(1); - list.add(2); - list.add(14); - let res = list.convertToArray(); - - let a = [4, 3, 1, 2, 14]; - for (let i = 0; i < a.length; i++) { - expect(res[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_CONVERT_TO_ARRAY_002 - * @tc.name : testConvertToArray002 - * @tc.desc : Convert an List instance to an array. For example: list.convertToArray(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertToArray002", 0, function () { - let list = new List(); - const res = list.convertToArray(); - expect(res.length).assertEqual(0); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the List instance is empty. For example: list.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let list = new List(); - list.add(8); - list.add("一"); - list.add("二"); - list.add(5); - let c = [1, 2, 3, 4]; - list.add(c); - list.add(6); - list.add("三"); - list.add("四"); - let res = list.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the List instance is empty. For example: list.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let list = new List(); - let res = list.isEmpty(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_EMPTY_003 - * @tc.name : testIsEmpty003 - * @tc.desc : Determine whether the List instance is empty. For example: list.isEmpty.bind({}, "a")(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty003", 0, function () { - let list = new List(); - try { - list.isEmpty.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The isEmpty method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterates over all elements in an List instance. For example: List[Symbol.iterator](). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let list = new List(); - list.add("a"); - list.add("b"); - list.add("c"); - list.add("a"); - list.add("b"); - list.removeByIndex(2); - let arr = []; - let itr = list[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = ["a", "b", "a", "b"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - - - }) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryListetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/app.json deleted file mode 100644 index 5a0fb344e47497c52945843cd3e635e53e519f37..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.TreeMap.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/BUILD.gn deleted file mode 100644 index 903d1e3b9977c00e9f3fd792549b35f3cca763bf..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformTreeMapTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformTreeMapTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/Test.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/Test.json deleted file mode 100644 index f6bf9632dd8cf6c6739f64e80d29cd1b76412ee6..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/Test.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.TreeMap.normal", - "module-name": "entry_test" - }, - - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformTreeMapTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/signature/openharmony_sx.p7b deleted file mode 100644 index 3054d8b2ff0f2f0e5bb550406c14ee8a24baa1bc..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 5a775217306daf6984f1dfa49c7303066eb7564c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import TreeMapTest from './TreeMap.test' - -export default function testsuite() { - TreeMapTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/TreeMap.test.ets b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/TreeMap.test.ets deleted file mode 100644 index 3d20a2031afe36e79f37eb8ee8452f75fbb8941a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/ets/test/TreeMap.test.ets +++ /dev/null @@ -1,732 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import TreeMap from "@ohos.util.TreeMap"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function TreeMapTest() { -describe("TreeMapTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an TreeMap instance. For example: let treeMap = new TreeMap(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - try { - let treeMap = new TreeMap(); - expect(treeMap != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The TreeMap's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of key value pairs in the TreeMap instance. For example: treeMap.length. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 1 - */ - it("testLength001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_LENGTH_002 - * @tc.name : testLength002 - * @tc.desc : Get the number of key value pairs in the TreeMap instance. For example: treeMap.length. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 1 - */ - it("testLength002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_ISEMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the TreeMap instance is empty. For example: treeMap.isEmpty(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.isEmpty(); - expect(res).assertEqual(false); - treeMap.clear(); - let res1 = treeMap.isEmpty(); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_HASKEY_001 - * @tc.name : testHasKey001 - * @tc.desc : Determine whether the TreeMap contains the specified key. For example: treeMap.hasKey(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasKey001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - let res = treeMap.hasKey(1); - expect(res).assertEqual(true); - let res1 = treeMap.hasKey(6); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_HASVALUE_001 - * @tc.name : testHasValue001 - * @tc.desc : Determine whether the TreeMap contains the specified Value. For example: treeMap.hasValue("a"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasValue001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - let res = treeMap.hasValue("a"); - expect(res).assertEqual(true); - let res1 = treeMap.hasValue("d"); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_GET_001 - * @tc.name : testGet001 - * @tc.desc : Get the corresponding value through the key. For example: treeMap.get(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - let res = treeMap.get(1); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number: TEST_GET_002 - * @tc.name : testGet002 - * @tc.desc : Get the corresponding value through the key. For example: treeMap.get(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.get(1); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_003 - * @tc.name : testGet003 - * @tc.desc : Get the corresponding value through the key. For example: treeMap.get(0). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet003", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.clear(); - expect(treeMap.length).assertEqual(0); - let res = treeMap.get(0); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GETFIRSTKEY_001 - * @tc.name : testGetFirstKey001 - * @tc.desc : Get the key that ranks first in the TreeMap instance. For example: treeMap.getFirstKey(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirstKey001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - let res = treeMap.getFirstKey(); - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_GETFIRSTKEY_002 - * @tc.name : testGetFirstKey002 - * @tc.desc : Get the key that ranks first in the TreeMap instance. For example: treeMap.getFirstKey(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirstKey002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.getFirstKey(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GETLASTKEY_001 - * @tc.name : testGetLastKey001 - * @tc.desc : Get the last sorted key in the TreeMap instance. For example: treeMap.getLastKey(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastKey001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - let res = treeMap.getLastKey(); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_GETLASTKEY_002 - * @tc.name : testGetLastKey002 - * @tc.desc : Get the last sorted key in the TreeMap instance. For example: treeMap.getLastKey(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastKey002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.getLastKey(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_SETALL_001 - * @tc.name : testSetAll001 - * @tc.desc : Copy key value pairs from one HashMap to another. For example: treeMap.setAll(treeMap1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAll001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - let treeMap1 = new TreeMap(); - treeMap1.set(0, "a"); - treeMap1.set(1, "b"); - treeMap1.set(2, "c"); - treeMap.setAll(treeMap1); - let res = treeMap.get(0); - expect(res).assertEqual("a"); - let res1 = treeMap.get(1); - expect(res1).assertEqual("b"); - let res2 = treeMap.get(2); - expect(res2).assertEqual("c"); - }); - - /** - * @tc.number: TEST_SET_001 - * @tc.name : testSet001 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(0, "四"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "四"); - let res = treeMap.get(0); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number: TEST_SET_002 - * @tc.name : testSet002 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(0, 8). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet002", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, 8); - let res = treeMap.get(0); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_SET_003 - * @tc.name : testSet003 - * @tc.desc : Add a pair of key value pairs to the TreeMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet003", 0, function () { - let treeMap = new TreeMap(); - let a = [1, 2, 3, 4]; - treeMap.set(0, a); - let res = treeMap.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_SET_004 - * @tc.name : testSet004 - * @tc.desc : Add a pair of key value pairs to the TreeMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet004", 0, function () { - let treeMap = new TreeMap(); - let a = {name: "lala", age: "13"}; - treeMap.set(0, a); - let res = treeMap.get(0); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_SET_005 - * @tc.name : testSet005 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(2, "*"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet005", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(2, "*"); - let res = treeMap.get(2); - expect(res).assertEqual("*"); - }); - - /** - * @tc.number: TEST_SET_006 - * @tc.name : testSet006 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(-2, 3.14). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet006", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(-2, 3.14); - let res = treeMap.get(-2); - expect(res).assertEqual(3.14); - }); - - /** - * @tc.number: TEST_SET_007 - * @tc.name : testSet007 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(100, true). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet007", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(100, true); - let res = treeMap.get(100); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_SET_008 - * @tc.name : testSet008 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set(100, true). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet008", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(100, ""); - let res = treeMap.get(100); - expect(res).assertEqual(""); - }); - - /** - * @tc.number: TEST_SET_009 - * @tc.name : testSet009 - * @tc.desc : Add a pair of key value pairs to the TreeMap. For example: treeMap.set("a", "四"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet009", 0, function () { - let treeMap = new TreeMap(); - treeMap.set("a", "四"); - let res = treeMap.get("a"); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number: TEST_SET_010 - * @tc.name : testSet010 - * @tc.desc : Add a pair of key value pairs to the TreeMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet010", 0, function () { - let treeMap = new TreeMap(); - for (let i = 0; i < 10000; i++) { - treeMap.set(0, 8); - } - let res = treeMap.get(0); - expect(res).assertEqual(8); - expect(treeMap.length).assertEqual(1); - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete key value pairs according to key. For example: treeMap.remove(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - let res = treeMap.remove(1); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete key value pairs according to key. For example: treeMap.remove(1). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - let res = treeMap.remove(1); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all key value pairs in TreeMap. For example: treeMap.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.clear(); - let res = treeMap.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all key value pairs in TreeMap. For example: treeMap.clear(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.clear(); - let res = treeMap.length; - expect(res).assertEqual(0); - treeMap.set(3, "d"); - let va = treeMap.get(3); - expect(va).assertEqual("d"); - }); - - /** - * @tc.number: TEST_GETLOWERKEY_001 - * @tc.name : testGetLowerKey001 - * @tc.desc : Get a key that is a little lower than the specified key sort. - * For example: treeMap.getLowerKey(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLowerKey001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.getLowerKey(2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GETLOWERKEY_002 - * @tc.name : testGetLowerKey002 - * @tc.desc : Get a key that is a little lower than the specified key sort. For example: treeMap.getLowerKey(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLowerKey002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.getLowerKey(2); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GETHIGHERKEY_001 - * @tc.name : testGetHigherKey001 - * @tc.desc : Get a key that is a little higher than the specified key sort. For example: treeMap.getLowerKey(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetHigherKey001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.getHigherKey(2); - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_GETHIGHERKEY_002 - * @tc.name : testGetHigherKey002 - * @tc.desc : Get a key that is a little higher than the specified key sort. For example: treeMap.getLowerKey(2). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetHigherKey002", 0, function () { - let treeMap = new TreeMap(); - let res = treeMap.getHigherKey(2); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_KEYS_001 - * @tc.name : testKeys001 - * @tc.desc : Get a collection of all the keys in the TreeMap. For example: treeMap.keys(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testKeys001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.keys(); - expect(res.next().value).assertEqual(0); - expect(res.next().value).assertEqual(1); - expect(res.next().value).assertEqual(2); - expect(res.next().value).assertEqual(3); - expect(res.next().value).assertEqual(4); - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Get a collection of all the values in the TreeMap. For example: treeMap.values(). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testValues001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.values(); - expect(res.next().value).assertEqual("a"); - expect(res.next().value).assertEqual("b"); - expect(res.next().value).assertEqual("c"); - expect(res.next().value).assertEqual("d"); - expect(res.next().value).assertEqual("g"); - }); - - /** - * @tc.number: TEST_REPLACE_001 - * @tc.name : testReplace001 - * @tc.desc : Modify the corresponding value according to the specified key. For example: treeMap.replace(2, "B"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplace001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let res = treeMap.replace(2, "B"); - let res1 = treeMap.get(2); - expect(res1).assertEqual("B"); - }); - - /** - * @tc.number: TEST_REPLACE_002 - * @tc.name : testReplace002 - * @tc.desc : Modify the corresponding value according to the specified key. For example: treeMap.replace(2, "B"). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplace002", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - let res = treeMap.replace(2, "B"); - expect(res).assertEqual(false); - let res1 = treeMap.get(2); - expect(res1).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_FOREACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse all key value pairs in the TreeMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let arr1 = []; - let arr2 = []; - treeMap.forEach((value, key) => { - arr1.push(value); - }); - treeMap.forEach((value, key) => { - arr2.push(key); - }); - let arr = ["a", "b", "c", "d", "g"]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - let arr3 = [0, 1, 2, 3, 4]; - for (let i = 0; i < arr3.length; i++) { - expect(arr3[i]).assertEqual(arr2[i]); - } - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Get all key value pairs collection in TreeMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let entries = treeMap.entries(); - let flag = true; - for (let i = 0, len = treeMap.length; i < len; i++) { - let entry = entries.next().value; - let res = treeMap.get(entry[0]); - if (res != entry[1]) { - flag = false; - break; - } - } - expect(flag).assertEqual(true); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Traverse all key value pairs in the TreeMap instance. For example: treeMap[Symbol.iterator](). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let treeMap = new TreeMap(); - treeMap.set(0, "a"); - treeMap.set(1, "b"); - treeMap.set(2, "c"); - treeMap.set(3, "d"); - treeMap.set(4, "g"); - let iters = treeMap[Symbol.iterator](); - let flag = true; - for (let i = 0, len = treeMap.length; i < len; i++) { - let entry = iters.next().value; - let res = treeMap.get(entry[0]); - if (res != entry[1]) { - flag = false; - break; - } - } - expect(flag).assertEqual(true); - }); - -}) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryTreeMapetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/app.json deleted file mode 100755 index b4285b4a9beac586a5973871c65cf16fff25b40f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.Worker.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryWorkeretstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryWorkeretstest/BUILD.gn deleted file mode 100755 index b929c4ee9e405e2970d00b405fe1b7287b6c7480..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformWorkerTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformWorkerTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/Test.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/Test.json deleted file mode 100755 index 09ff8d9f248558315090233154cf012e366be80f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/Test.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.Worker.normal", - "module-name": "entry_test" - }, - - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformWorkerTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryWorkeretstest/signature/openharmony_sx.p7b deleted file mode 100755 index 75cbe47f3cc085f35c5d5e98adec2ee230717afd..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryWorkeretstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 359f865b5931a6abb6f13cd1b940e5e37a265f7a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import WorkerTest from './Worker.test' -export default function testsuite() { - WorkerTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/Worker.test.ets b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/Worker.test.ets deleted file mode 100755 index 88ff3819bbfe04fbd7d4cbc62247d7c0eea5b790..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/test/Worker.test.ets +++ /dev/null @@ -1,1555 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ - -import worker from "@ohos.worker"; -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect, -} from "@ohos/hypium"; -export default function WorkerTest() { - describe("WorkerTest", function () { - afterAll(function () { - console.info("total case over"); - }); - - function promiseCase() { - let p = new Promise(function (resolve, reject) { - setTimeout(function () { - resolve(0); - }, 100); - }).then(undefined, (error) => {}); - return p; - } - - /** - * @tc.number: TEST_WORKEREVENTLISTENER_001 - * @tc.name : test_WorkerEventListener_WorkerEventListener_001 - * @tc.desc : Add an event listener to the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_WorkerEventListener_WorkerEventListener_001",0,async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_036.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(2); - done(); - } - ); - - /** - * @tc.number: TEST_DISPATCHEVENT_001 - * @tc.name : test_WorkerEventTarget_DispatchEvent_001 - * @tc.desc : Distribute the events defined in the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_WorkerEventTarget_DispatchEvent_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_033.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.on("zhangsan", () => { - zhangSanTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(1); - - ss.removeEventListener("zhangsan"); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - expect(zhangSanTimes).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_REMOVEVENTELISTENER_001 - * @tc.name : test_WorkerEventTarget_RemoveEventListener_001 - * @tc.desc : Removes an event defined for the worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_WorkerEventTarget_RemoveEventListener_001",0,async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_033.js" - ); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(1); - - ss.removeEventListener("zhangsan"); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(zhangSanTimes).assertEqual(1); - done(); - } - ); - - /** - * @tc.number: TEST_REMOVEALLLISTENER_001 - * @tc.name : test_WorkerEventTarget_RemoveAllListener_001 - * @tc.desc : Delete all event listeners for Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it( - "test_WorkerEventTarget_RemoveAllListener_001", - 0, - async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_033.js" - ); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - - let liSiTimes = 0; - ss.addEventListener("lisi", () => { - liSiTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(2); - - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - expect(liSiTimes).assertEqual(2); - - ss.removeAllListener(); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(2); - - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(liSiTimes).assertEqual(2); - done(); - } - ); - - /** - * @tc.number: TEST_ONERROR_001 - * @tc.name : test_GlobalScope_OnError_001 - * @tc.desc : Called when an exception occurs during execution in the Worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_GlobalScope_OnError_001", 0, async function (done) { - const ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_035.js" - ); - let res = undefined; - let flag = false; - - ss.onmessage = function (e) { - res = e.data; - flag = true; - }; - - ss.postMessage({ type: "new" }); - while (!flag) { - await promiseCase(); - } - expect(res).assertEqual("Error: 123"); - - done(); - }); - - /** - * @tc.number: TEST_ONMESSAGE_001 - * @tc.name : test_ThreadWorkerGlobalScope_OnMessage_001 - * @tc.desc : Receive information sent by the main thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorkerGlobalScope_OnMessage_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_010.js" - ); - let flag = false; - let res = undefined; - - ss.onmessage = function (e) { - flag = true; - res = e.data; - }; - - ss.postMessage({ type: "new", value: 12 }); - while (!flag) { - await promiseCase(); - } - expect(res).assertEqual(25); - - ss.terminate(); - - done(); - }); - - /** - * @tc.number: TEST_ONMESSAGEERROR_001 - * @tc.name : test_ThreadWorkerGlobalScope_OnMessageError_001 - * @tc.desc : Worker object receives a message that cannot be deserialized - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it( - "test_ThreadWorkerGlobalScope_OnMessageError_001", - 0, - async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_028.js" - ); - let res = undefined; - let flag = false; - ss.onmessage = function (d) { - res = d.data; - flag = true; - }; - - ss.postMessage({ type: "new" }); - while (!flag) { - await promiseCase(); - } - ss.terminate(); - - expect(res).assertEqual(1); - done(); - } - ); - - /** - * @tc.number: TEST_CLOSE_001 - * @tc.name : test_ThreadWorkerGlobalScope_Close_001 - * @tc.desc : Destroy the worker thread and stop the worker from receiving messages. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorkerGlobalScope_Close_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_030.js" - ); - let res = 0; - let flag = false; - - ss.onexit = function () { - flag = true; - res++; - }; - - ss.postMessage(10); - while (!flag) { - await promiseCase(); - } - expect(res).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_001 - * @tc.name : test_ThreadWorkerGlobalScope_PostMessage_001 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it( - "test_ThreadWorkerGlobalScope_PostMessage_001", - 0, - async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_0151.js" - ); - let res = undefined; - let flag = false; - ss.onmessage = function (e) { - flag = true; - res = e.data; - }; - ss.postMessage({ type: "new", value: 11 }); - while (!flag) { - await promiseCase(); - } - ss.terminate(); - expect(res).assertEqual(16); - done(); - } - ); - - /** - * @tc.number: TEST_POSTMESSAGE_001 - * @tc.name : test_ThreadWorkerGlobalScope_PostMessage_001 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it( - "test_ThreadWorkerGlobalScope_PostMessage_001", - 0, - async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_032.js" - ); - let isTerminate = false; - let flag = false; - let res = undefined; - - ss.onexit = function () { - isTerminate = true; - }; - ss.onmessage = function (e) { - flag = true; - res = e.data; - }; - ss.postMessage({ type: "new" }); - - while (!flag) { - await promiseCase(); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - expect(res).assertEqual("IsDetachedBuffer"); - done(); - } - ); - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : test_ThreadWorker_Constructor_001 - * @tc.desc : worker constructor to Creates a worker instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Constructor_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - expect(ss != null).assertTrue(); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - done(); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_002 - * @tc.name : test_ThreadWorker_Constructor_002 - * @tc.desc : worker constructor to Creates a worker instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Constructor_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js", { - name: "1st worker", - shared: false, - }); - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - expect(ss != null).assertTrue(); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - done(); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_003 - * @tc.name : test_ThreadWorker_Constructor_003 - * @tc.desc : worker constructor to Creates a worker instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Constructor_003", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js", { - type: "classic", - name: "2st worker", - shared: false, - }); - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - expect(ss != null).assertTrue(); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - done(); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_004 - * @tc.name : test_ThreadWorker_Constructor_004 - * @tc.desc : worker constructor to Creates a worker instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Constructor_004", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js", { - type: "classic", - name: "3st worker", - shared: true, - }); - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - expect(ss != null).assertTrue(); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - done(); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_005 - * @tc.name : test_ThreadWorker_Constructor_005 - * @tc.desc : worker constructor to Creates a worker instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Constructor_005", 0, async function (done) { - let ss = new worker.ThreadWorker( - "@bundle:com.example.threadWorkertest/entry_test/ets/workers/newworker.js" - ); - let isTerminate = false; - ss.onexit = function () { - isTerminate = true; - }; - expect(ss != null).assertTrue(); - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - done(); - }); - - /** - * @tc.number: TEST_ONEXIT_001 - * @tc.name : test_ThreadWorker_OnExit_001 - * @tc.desc : Monitor whether the worker is destroyed - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_OnExit_001", 0, async function (done) { - let ss = new worker.ThreadWorker("/entry_test/ets/workers/newworker.js"); - let isTerminate = false; - ss.onexit = function () { - isTerminate = true; - }; - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - expect(isTerminate).assertTrue(); - done(); - }); - - /** - * @tc.number: TEST_ONERROR_001 - * @tc.name : test_ThreadWorker_OnError_001 - * @tc.desc : Listen to the worker for any exceptions during execution - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_OnError_001", 0, async function (done) { - const ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_007.js" - ); - let res = undefined; - let flag = false; - ss.onerror = function (e) { - res = e.message; - expect(e.filename).assertEqual( - "entry_test/ets/workers/newworker_007.js" - ); - expect(e.lineno).assertEqual(0); - expect(e.colno).assertEqual(0); - expect(e.error == "Error: 123").assertTrue(); - flag = true; - }; - - ss.postMessage("hello world"); - while (!flag) { - await promiseCase(); - } - - expect(res).assertEqual("Error: 123"); - done(); - }); - - /** - * @tc.number: TEST_ONMESSAGE_001 - * @tc.name : test_ThreadWorker_OnMessage_001 - * @tc.desc : Receives information from child threads - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_OnMessage_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_002.js" - ); - let res = undefined; - let flag = false; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - ss.onmessage = function (e) { - res = e.data; - flag = true; - }; - - ss.postMessage("hello world"); - while (!flag) { - await promiseCase(); - } - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(res).assertEqual("hello world worker"); - done(); - }); - - /** - * @tc.number: TEST_ONMESSAGEERROR_001 - * @tc.name : test_ThreadWorker_OnMessageError_001 - * @tc.desc : Listening for worker object to receive a message that cannot be serialized - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_OnMessageError_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_008.js" - ); - let res = 0; - let flag = false; - - ss.onexit = function () { - flag = true; - }; - - ss.onmessageerror = function (e) { - res++; - }; - - ss.postMessage("abc"); - while (!flag) { - await promiseCase(); - } - expect(res).assertEqual(0); - done(); - }); - - /** - * @tc.number: TEST_ONMESSAGEERROR_002 - * @tc.name : test_ThreadWorker_OnMessageError_002 - * @tc.desc : Listening for worker object to receive a message that cannot be serialized - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_OnMessageError_002", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_021.js" - ); - let flag = false; - let isTerminate = false; - ss.onmessageerror = function (d) { - flag = true; - }; - ss.onexit = function () { - isTerminate = true; - }; - try { - const data = Symbol(); - ss.postMessage(data); - } catch (error) { - console.info("worker:: recv error message: " + error.message); - while (!flag) { - await promiseCase(); - } - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - } - expect(flag).assertTrue(); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_001 - * @tc.name : test_ThreadWorker_PostMessage_001 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_PostMessage_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_002.js" - ); - - let res = undefined; - let flag = false; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.onmessage = function (e) { - res = e.data; - flag = true; - }; - - ss.postMessage("hello world"); - while (!flag) { - await promiseCase(); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(res).assertEqual("hello world worker"); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_002 - * @tc.name : test_ThreadWorker_PostMessage_002 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_PostMessage_002", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_003.js" - ); - - let res = undefined; - let flag = false; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.onmessage = function (e) { - res = e.data; - flag = true; - }; - - ss.postMessage(12); - while (!flag) { - await promiseCase(); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(res).assertEqual(25); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_003 - * @tc.name : test_ThreadWorker_PostMessage_003 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_PostMessage_003", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_004.js" - ); - - let res = undefined; - let flag = false; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.onmessage = function (e) { - res = e.data.message; - flag = true; - }; - - ss.postMessage({ message: "hello world" }); - while (!flag) { - await promiseCase(); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(res).assertEqual("hello world worker"); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_004 - * @tc.name : test_ThreadWorker_PostMessage_004 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_PostMessage_004", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_005.js", - { name: "zhangsan" } - ); - - let res = undefined; - let flag = false; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.onmessage = function (e) { - res = e.data; - console.info("worker:: type " + e.type); - console.info("worker:: timeStamp " + e.timeStamp); - flag = true; - }; - - ss.postMessage("hello world"); - while (!flag) { - await promiseCase(); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(res).assertEqual("zhangsan"); - done(); - }); - - /** - * @tc.number: TEST_POSTMESSAGE_001 - * @tc.name : test_ThreadWorker_PostMessage_001 - * @tc.desc : Sends a message to the worker thread. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_PostMessage_001", 0, async function (done) { - let ss = new worker.ThreadWorker( - "entry_test/ets/workers/newworker_006.js" - ); - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - - const buffer = new ArrayBuffer(8); - expect(buffer.byteLength).assertEqual(8); - ss.postMessage(buffer, [buffer]); - let length = undefined; - let exception = undefined; - try { - length = buffer.byteLength; - } catch (e) { - exception = e.message; - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - console.log("worker:: length is " + length); - console.log("worker:: exception is " + exception); - - if (typeof exception == "undefined") { - expect(length).assertEqual(0); - } else { - expect(exception).assertEqual("IsDetachedBuffer"); - } - done(); - }); - - /** - * @tc.number: TEST_ONCE_001 - * @tc.name : test_ThreadWorker_Once_001 - * @tc.desc : Add an event listener. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Once_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.once("zhangsan", () => { - times++; - }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_ONCE_002 - * @tc.name : test_ThreadWorker_Once_002 - * @tc.desc : Add an event listener. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Once_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.once("zhangsan", () => { - times++; - }); - - for (let i = 0; i < 10; i++) { - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_ONCE_003 - * @tc.name : test_ThreadWorker_Once_003 - * @tc.desc : Add an event listener. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Once_003", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.once("zhangsan", () => { - times--; - }); - - ss.once("lisi", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(0); - done(); - }); - - /** - * @tc.number: TEST_ONCE_004 - * @tc.name : test_ThreadWorker_Once_004 - * @tc.desc : Add an event listener. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Once_004", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let isTerminate = false; - let times = 0; - - try { - ss.once("zhangsan", () => { - times++; - }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.onexit = function () { - isTerminate = true; - }; - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - ss.once("lisi", () => { - times++; - }); - expect(times).assertEqual(1); - } catch (error) { - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual( - "Worker instance is not running, maybe worker is terminated" - ); - - done(); - } - }); - - /** - * @tc.number: TEST_TERMINATE_001 - * @tc.name : test_ThreadWorker_Terminate_001 - * @tc.desc : Terminates the worker thread to stop the worker from receiving messages. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Terminate_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - let res = 0; - let flag = false; - - ss.onexit = function () { - flag = true; - res++; - }; - - ss.terminate(); - while (!flag) { - await promiseCase(); - } - - expect(res).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_TERMINATE_002 - * @tc.name : test_ThreadWorker_Terminate_002 - * @tc.desc : Terminates the worker thread to stop the worker from receiving messages. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Terminate_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - let res = 0; - let flag = false; - - ss.onexit = function () { - flag = true; - res++; - }; - - ss.terminate(); - ss.terminate(); - - while (!flag) { - await promiseCase(); - } - - expect(res).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_TERMINATE_003 - * @tc.name : test_ThreadWorker_Terminate_003 - * @tc.desc : Terminates the worker thread to stop the worker from receiving messages. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_Terminate_003", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - let res = 0; - let flag = false; - - ss.onexit = function () { - flag = true; - res++; - }; - ss.onmessage = function (e) { - res++; - }; - - ss.terminate(); - while (!flag) { - await promiseCase(); - } - expect(res).assertEqual(1); - - try { - ss.postMessage("hello world"); - await promiseCase(); - } catch (error) { - let msg = - "Worker instance is not running, maybe worker is terminated when PostMessage"; - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual(msg); - done(); - } - }); - - /** - * @tc.number: TEST_ADDEVENTLISTENER_001 - * @tc.name : test_ThreadWorker_AddEventListener_001 - * @tc.desc : Add an event listener to the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_AddEventListener_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(2); - done(); - }); - - /** - * @tc.number: TEST_ADDEVENTLISTENER_002 - * @tc.name : test_ThreadWorker_AddEventListener_002 - * @tc.desc : Add an event listener to the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_AddEventListener_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - times++; - }); - ss.addEventListener("lisi", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(2); - done(); - }); - - /** - * @tc.number: TEST_ADDEVENTLISTENER_003 - * @tc.name : test_ThreadWorker_AddEventListener_003 - * @tc.desc : Add an event listener to the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_AddEventListener_003", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - times++; - }); - - for (let i = 0; i < 10; i++) { - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - } - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(times).assertEqual(10); - done(); - }); - - /** - * @tc.number: TEST_ADDEVENTLISTENER_004 - * @tc.name : test_ThreadWorker_AddEventListener_004 - * @tc.desc : Add an event listener to the Worker when throw error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_AddEventListener_004", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - try { - ss.addEventListener("zhangsan", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.onexit = function () { - isTerminate = true; - }; - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - ss.addEventListener("lisi", () => { - times++; - }); - expect(times).assertEqual(1); - } catch (error) { - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual( - "Worker instance is not running, maybe worker is terminated" - ); - done(); - } - }); - - /** - * @tc.number: TEST_ADDEVENTLISTENER_005 - * @tc.name : test_ThreadWorker_AddEventListener_005 - * @tc.desc : Add an event listener to the Worker when throw error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_AddEventListener_005", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let times = 0; - let isTerminate = false; - - try { - ss.addEventListener("zhangsan", () => { - times++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.onexit = function () { - isTerminate = true; - }; - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(times).assertEqual(1); - } catch (error) { - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual( - "Worker instance is not running, maybe worker has been terminated" - ); - done(); - } - }); - - /** - * @tc.number: TEST_DISPATCHEVENT_001 - * @tc.name : test_ThreadWorker_DispatchEvent_001 - * @tc.desc : Distribute the events defined in the Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_DispatchEvent_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.on("zhangsan", () => { - zhangSanTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(1); - - ss.removeEventListener("zhangsan"); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - expect(zhangSanTimes).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_REMOVEVENTELISTENER_001 - * @tc.name : test_ThreadWorker_RemoveEventListener_001 - * @tc.desc : Removes an event defined for the worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_RemoveEventListener_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(1); - - ss.removeEventListener("zhangsan"); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(zhangSanTimes).assertEqual(1); - done(); - }); - - /** - * @tc.number: TEST_REMOVEVENTELISTENER_002 - * @tc.name : test_ThreadWorker_RemoveEventListener_002 - * @tc.desc : Removes an event defined for the worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_RemoveEventListener_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(2); - - for (let i = 0; i < 3; i++) { - ss.removeEventListener("zhangsan"); - } - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(zhangSanTimes).assertEqual(2); - done(); - }); - - /** - * @tc.number: TEST_REMOVELISTENER_003 - * @tc.name : test_ThreadWorker_RemoveEventListener_003 - * @tc.desc : Removes an event defined for the worker when throw error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_RemoveEventListener_003", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - try { - ss.removeEventListener("zhangsan"); - } catch (error) { - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual( - "Worker instance is not running, maybe worker is terminated" - ); - done(); - } - }); - - /** - * @tc.number: TEST_REMOVEALLLISTENER_001 - * @tc.name : test_ThreadWorker_RemoveAllListener_001 - * @tc.desc : Delete all event listeners for Worker. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_RemoveAllListener_001", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - - let liSiTimes = 0; - ss.addEventListener("lisi", () => { - liSiTimes++; - }); - - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(2); - - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - expect(liSiTimes).assertEqual(2); - - ss.removeAllListener(); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - ss.dispatchEvent({ type: "zhangsan", timeStamp: 0 }); - expect(zhangSanTimes).assertEqual(2); - - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - ss.dispatchEvent({ type: "lisi", timeStamp: 0 }); - - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - - expect(liSiTimes).assertEqual(2); - done(); - }); - - /** - * @tc.number: TEST_REMOVEALLLISTENER_002 - * @tc.name : test_ThreadWorker_RemoveAllListener_002 - * @tc.desc : Delete all event listeners for Worker when throw error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("test_ThreadWorker_RemoveAllListener_002", 0, async function (done) { - let ss = new worker.ThreadWorker("entry_test/ets/workers/newworker.js"); - - let zhangSanTimes = 0; - let isTerminate = false; - - ss.onexit = function () { - isTerminate = true; - }; - ss.addEventListener("zhangsan", () => { - zhangSanTimes++; - }); - ss.terminate(); - while (!isTerminate) { - await promiseCase(); - } - try { - ss.removeAllListener(); - } catch (error) { - expect(error.name).assertEqual("BusinessError"); - expect(error.message).assertEqual( - "Worker instance is not running, maybe worker is terminated" - ); - done(); - } - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker.js deleted file mode 100755 index 78e75378bf3d40c3d9edf07ba5496b28709e3aba..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - console.info("worker:: worker thread worker data is " + data.data); - switch(data.type) { - case "normal": - console.info("worker:: worker thread receive data " + data.data); - parentPort.postMessage(data); - console.info("worker:: worker thread post back"); - break; - case "error": - throw new Error("123"); - case "buffer": - console.info("worker:: worker.js receive buffer length is " + data.data.byteLength); - parentPort.postMessage(data, [data.data]); - console.info("worker:: worker.js post buffer length is " + data.data.byteLength); - break; - case "self": - parentPort.postMessage(data.name); - default: - console.info("worker:: worker.js receive unknow type"); - break - } -} - -// Deserialization error -parentPort.onmessageerror = function() { - console.info("worker:: worker.js onmessageerror"); -} - -// js execution error -parentPort.onerror = function(data) { - console.info("worker:: worker.js onerror " + data.lineno + ", msg = " + data.message + ", filename = " + data.filename + ", colno = " + data.colno); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_002.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_002.js deleted file mode 100755 index 3e4f7b91828c57b4bca06b5be96b84c24ad419af..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_002.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - console.log("worker:: worker receive data " + e.data); - let data = e.data + " worker"; - parentPort.postMessage(data) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_003.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_003.js deleted file mode 100755 index f66f4d2acf143009acc5c37516d57dcd4e293693..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_003.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data * 2 + 1 - parentPort.postMessage(data) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_004.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_004.js deleted file mode 100755 index 329eb9cd6a60b60483b6a5e5c036fef297be4971..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_004.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - data.message = "hello world " + "worker" - parentPort.postMessage(data) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_005.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_005.js deleted file mode 100755 index 893dcc101c18bd54b5268eaf3e1568cd1d81d079..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_005.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.postMessage(name) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_006.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_006.js deleted file mode 100755 index 0c6dfc57aaf488eaaf46d6314c27e32a12ed254e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_006.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.postMessage("hello world") -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_007.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_007.js deleted file mode 100755 index eea8e1d7cb405c37b448f6fb59947c2b620715b5..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_007.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - throw new Error("123") -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_008.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_008.js deleted file mode 100755 index 2c7735910090cb24794e7ce36364936b0f9ae9fe..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_008.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.close() -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_009.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_009.js deleted file mode 100755 index d3cd19d8cb05d1062c2816f48d3f7a9f5e2c4cf4..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_009.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" -const parentPort = worker.workerPort; - -var ss = undefined; -var flag = false; -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0091.js"); - ss.onexit = function() { - flag = true; - } - parentPort.postMessage(ss != null); - break; - case "wait": - if (flag) { - parentPort.postMessage("terminate"); - } - break; - case "terminate": - flag = false; - ss.terminate(); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0091.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0091.js deleted file mode 100755 index a1f89bb6d2ab36a477544a2fb8235d0b0a5ed079..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0091.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - console.log("worker:: onmessage"); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_010.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_010.js deleted file mode 100755 index d94003eccddb013322bfa3f818ed9a63f95a3431..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_010.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0101.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - ss.terminate(); - } - - ss.onexit = function() { - parentPort.postMessage(backValue); - } - ss.postMessage(data.value); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0101.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0101.js deleted file mode 100755 index d96c06f5d8944926170b89a5d27c7dafd2d5d500..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0101.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; // 12 - parentPort.postMessage(data * 2 + 1); // 25 -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_011.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_011.js deleted file mode 100755 index d876fe1f82b2a2ea81238f59d7c4d092ef0ce98f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_011.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0111.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - flag = true; - } - ss.onexit = function(code) { - backValue = "terminate"; - flag = true; - } - ss.postMessage(data.value); - break; - case "wait": - if (flag) { - parentPort.postMessage(backValue); - } - break; - case "terminate": - flag = false; - ss.terminate(); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0111.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0111.js deleted file mode 100755 index 8e4314a3fda6ffe113566bf9f6d1adc9647f63a5..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0111.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - console.log("worker:: onmessage") - parentPort.postMessage("terminate"); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_012.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_012.js deleted file mode 100755 index f62e1fb504df15405b0ddcc6bd8db17ba275ac3d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_012.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0121.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - flag = true; - } - ss.onexit = function() { - backValue = "terminate"; - flag = true; - } - ss.postMessage({type: "new"}); - break; - case "wait": - if (flag) { - parentPort.postMessage(backValue); - } - break; - case "terminate": - flag = false; - ss.terminate(); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0121.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0121.js deleted file mode 100755 index a7e495e483efc450ca06e958094d30ef851463fa..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0121.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0122.js"); - ss.terminate(); - ss.onexit = function() { - parentPort.postMessage(ss != null); - } - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0122.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0122.js deleted file mode 100755 index 421e71d2735ec3e6c4be284c0deb0f60c0231c44..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0122.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - console.info("worker:: thrid worker onmessage") -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_013.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_013.js deleted file mode 100755 index 30607581363762dfb81ff6b094d4850e2517048f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_013.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - var data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0131.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - flag = true; - } - ss.onexit = function() { - backValue = "terminate"; - flag = true; - } - ss.postMessage(data.value); - break; - case "wait": - if (flag) { - parentPort.postMessage(backValue); - } - break; - case "terminate": - flag = false; - ss.terminate(); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0131.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0131.js deleted file mode 100755 index f39f27f28e74b025cc9d3ba894c534242610cdb7..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0131.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; // hello world - parentPort.postMessage(data + " worker"); // hello world worker -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_014.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_014.js deleted file mode 100755 index 301a019f3c7645a61098c446b32ffe19b86686bd..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_014.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0141.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - flag = true; - } - ss.onexit = function() { - backValue = "terminate"; - flag = true; - } - ss.postMessage(data.value); - break; - case "wait": - if (flag) { - parentPort.postMessage(backValue); - } - break; - case "terminate": - flag = false; - ss.terminate(); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0141.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0141.js deleted file mode 100755 index 79f9330fe36973700bc07d8863d5c8166203da88..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0141.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - data[0] += 1 - parentPort.postMessage(data); // [2, 2] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_015.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_015.js deleted file mode 100755 index 04234ae6dc5efd36bc7ba385f5f0159b9877b868..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_015.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; -var flag = false; - -parentPort.onmessage = function(e) { - var data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0151.js"); - ss.onexit = function() { - parentPort.postMessage(backValue); // 16 - } - ss.onmessage = function(ee) { - backValue = ee.data; // 16 - flag = true; - } - ss.postMessage({type: "new", value: data.value + 1}); // 11 - break; - case "wait": - ss.postMessage({type: "wait"}); - if (flag) { - ss.terminate(); - } - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0151.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0151.js deleted file mode 100755 index 6fefdb739f5269b440227220f528fab14bcc8352..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0151.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var backValue = undefined; - -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0152.js"); - ss.onmessage = function(ee) { - backValue = ee.data; - ss.terminate(); - } - ss.onexit = function() { - parentPort.postMessage(backValue); - } - ss.postMessage(data.value + 2); // 13 - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0152.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0152.js deleted file mode 100755 index fa0d6dfd42675b7d762b50482af98aab54faad7f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_0152.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - parentPort.postMessage(data + 3); // 16 -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_016.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_016.js deleted file mode 100755 index d69080d55c0e5bffdaa6721048b9f84b2cab4804..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_016.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - console.info("worker:: worker receive data " + e.data); - let data = e.data; - parentPort.postMessage(data.length); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_017.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_017.js deleted file mode 100755 index 4e2866f06a3f810b4057b4790afe4fbcc84ac86d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_017.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -class MyModel { - name = "worker" - Init() { - this.name = "MyModel" - } -} - -workerPort.onmessage = function(e) { - let obj = new MyModel(); - workerPort.postMessage(obj); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_018.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_018.js deleted file mode 100755 index 08face1f4c1377b2267da5f24ef5b49a1b99888c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_018.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - const data = e.data; - data.add(1); - data.add(2); - workerPort.postMessage(data); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_019.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_019.js deleted file mode 100755 index 5118e6318e531183f990972bcd6c885d6030d304..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_019.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - const data = e.data; - data.set("worker", "success"); - workerPort.postMessage(data); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_020.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_020.js deleted file mode 100755 index 72947d8ebc61739d87db29f3385754c3e8889c9c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_020.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - const data = e.data; - const view = new Int8Array(data).fill(3); - workerPort.postMessage(view); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_021.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_021.js deleted file mode 100755 index 3829bed0d7771023762988011b4fb56ed3668395..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_021.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - const data = e.data; - let str = "HI Worker"; - let newStr = str.replace(data, "$2, $1!"); - workerPort.postMessage(newStr); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_022.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_022.js deleted file mode 100755 index 882302543aa84f8e0cb9c5adb6ccd8ebe3229ab7..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_022.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - try { - workerPort.postMessage(); - } catch (e) { - let data = e.message; - workerPort.postMessage(data); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_023.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_023.js deleted file mode 100755 index dddd1a8350813f5542767f1b60ba6d3fb158f26d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_023.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - try { - workerPort.postMessage("123", "123"); - } catch (e) { - let data = e.message; - workerPort.postMessage(data); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_024.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_024.js deleted file mode 100755 index 0cc7f24ced263b8aec142bdb42c52e4eca6f6c76..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_024.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - try { - const symbol = Symbol(); - workerPort.postMessage(symbol); - } catch (e) { - let data = e.message; - workerPort.postMessage(data); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_025.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_025.js deleted file mode 100755 index a97b237ddd9c134276de2e2a6eac9206cad88d6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_025.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - workerPort.close(); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_026.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_026.js deleted file mode 100755 index c37b4e2053fd887b3cacc99434b41f5a6f7ac770..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_026.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - let model = e.data; - let str = model.name; - workerPort.postMessage(str); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_027.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_027.js deleted file mode 100755 index fab999317890d39ee44fb6461a87f8979572c66e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_027.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - let model = e.data; - let str = model.Init(); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_028.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_028.js deleted file mode 100755 index a0463554c532be3491d4aa79f267267ee45581b9..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_028.js +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var res = 0; -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_029.js"); - ss.onmessageerror = function (e) { - res++; - ss.terminate() - } - ss.onexit = function() { - parentPort.postMessage(res); - } - try { - const data = Symbol(); - ss.postMessage(data); - } catch (error) { - console.info("worker:: recv error message: " + error.message); - } - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_029.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_029.js deleted file mode 100755 index 3829bed0d7771023762988011b4fb56ed3668395..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_029.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const workerPort = worker.workerPort; - -workerPort.onmessage = function(e) { - const data = e.data; - let str = "HI Worker"; - let newStr = str.replace(data, "$2, $1!"); - workerPort.postMessage(newStr); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_030.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_030.js deleted file mode 100755 index 5bc99673107b584eb51c731f7fbe0a58a1458848..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_030.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.close() -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_031.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_031.js deleted file mode 100755 index 241f7ddae3e88165a7f620aec941d99d6721cf4e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_031.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.postMessage("hello world") -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_032.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_032.js deleted file mode 100755 index ea3f725074cbcc50814fde1c059f3ba32af3639f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_032.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" - -const parentPort = worker.workerPort; - -var ss = undefined; -var length = undefined; -var exception = undefined; -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_0031.js"); - ss.onexit = function () { - - parentPort.postMessage(exception); - } - const buffer = new ArrayBuffer(8) - ss.postMessage(buffer, [buffer]) - try { - length = buffer.byteLength - } catch (e) { - exception = e.message - } - - console.log("worker:: length is " + length) - console.log("worker:: exception is " + exception) - ss.terminate() - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_033.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_033.js deleted file mode 100755 index 78e75378bf3d40c3d9edf07ba5496b28709e3aba..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_033.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - console.info("worker:: worker thread worker data is " + data.data); - switch(data.type) { - case "normal": - console.info("worker:: worker thread receive data " + data.data); - parentPort.postMessage(data); - console.info("worker:: worker thread post back"); - break; - case "error": - throw new Error("123"); - case "buffer": - console.info("worker:: worker.js receive buffer length is " + data.data.byteLength); - parentPort.postMessage(data, [data.data]); - console.info("worker:: worker.js post buffer length is " + data.data.byteLength); - break; - case "self": - parentPort.postMessage(data.name); - default: - console.info("worker:: worker.js receive unknow type"); - break - } -} - -// Deserialization error -parentPort.onmessageerror = function() { - console.info("worker:: worker.js onmessageerror"); -} - -// js execution error -parentPort.onerror = function(data) { - console.info("worker:: worker.js onerror " + data.lineno + ", msg = " + data.message + ", filename = " + data.filename + ", colno = " + data.colno); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_034.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_034.js deleted file mode 100755 index 2fa7891cdcac93637732d7546f0f79e7264719f5..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_034.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - parentPort.postMessage(parentPort.name) - throw new Error("123") -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_035.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_035.js deleted file mode 100755 index 3e4ca9666c887daa5c3b26be1a3b2c9d0c3ed9fe..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_035.js +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import worker from "@ohos.worker" -const parentPort = worker.workerPort; - -var ss = undefined; -let res = undefined; -let mse = undefined; -parentPort.onmessage = function(e) { - let data = e.data; - switch(data.type) { - case "new": - ss = new worker.ThreadWorker("entry_test/ets/workers/newworker_034.js", {name:"worker"}); - ss.onerror = function (e) { - res = e.message; - parentPort.postMessage(res); - } - ss.onmessage = function (e) { - mse = e.data - } - ss.postMessage("hello world"); - break; - default: - break; - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_036.js b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_036.js deleted file mode 100755 index 78e75378bf3d40c3d9edf07ba5496b28709e3aba..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/ets/workers/newworker_036.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import worker from '@ohos.worker'; -const parentPort = worker.workerPort; - -parentPort.onmessage = function(e) { - let data = e.data; - console.info("worker:: worker thread worker data is " + data.data); - switch(data.type) { - case "normal": - console.info("worker:: worker thread receive data " + data.data); - parentPort.postMessage(data); - console.info("worker:: worker thread post back"); - break; - case "error": - throw new Error("123"); - case "buffer": - console.info("worker:: worker.js receive buffer length is " + data.data.byteLength); - parentPort.postMessage(data, [data.data]); - console.info("worker:: worker.js post buffer length is " + data.data.byteLength); - break; - case "self": - parentPort.postMessage(data.name); - default: - console.info("worker:: worker.js receive unknow type"); - break - } -} - -// Deserialization error -parentPort.onmessageerror = function() { - console.info("worker:: worker.js onmessageerror"); -} - -// js execution error -parentPort.onerror = function(data) { - console.info("worker:: worker.js onerror " + data.lineno + ", msg = " + data.message + ", filename = " + data.filename + ", colno = " + data.colno); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryWorkeretstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/app.json deleted file mode 100755 index dad9b1564f57df2a0266f432be7889246bc4efd0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.buffer.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 296ab88f6106ddb87dd3f340ac707fc9bf488785..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "Buffer.test.ets" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarybufferetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibrarybufferetstest/BUILD.gn deleted file mode 100755 index 9c5fe0f5e10dd9b7257735405c82c754ad3ae4d9..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformBufferTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformBufferTest" - part_name = "ets_utils" - subsystem_name = "commonlibrary" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/Test.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/Test.json deleted file mode 100755 index 7102e6dde7f593df5e90a98d27a98e07d9c7bd17..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.buffer.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformBufferTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibrarybufferetstest/signature/openharmony_sx.p7b deleted file mode 100755 index 890ae6f5d529aeda66ec1d9268249503ca08aeee..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarybufferetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index a535e83f79f890b0209acbfa7d873fd4de72104b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index dbc536ca80c5095e2bcb95bdf9ce4659ea973139..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/Buffer.test.ets b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/Buffer.test.ets deleted file mode 100755 index 627a7f3dc5c24d5d59cc1f2801d7456f956c0b23..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/Buffer.test.ets +++ /dev/null @@ -1,4003 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -import buffer from "@ohos.buffer"; - -type BufferEncoding = "ascii" | "utf8" | "utf-8" | "utf16le" | "ucs2" | "ucs-2" | "base64" | "base64url" | "latin1" | "binary" | "hex"; -export default function BufferTest() { - describe("BufferTest", function () { - /** - * @tc.number : TEST_ALLOC_001 - * @tc.name : testAlloc001 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(10); - */ - it("testAlloc001", 0, function () { - let buf = buffer.alloc(10); - expect(buf.length).assertEqual(10); - }); - - /** - * @tc.number : TEST_ALLOC_002 - * @tc.name : testAlloc002 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(10).fill(string); - */ - it("testAlloc002", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.alloc(10).fill("ab$#", undefined, undefined, encode); - expect(buf.length).assertEqual(10); - } - }); - - /** - * @tc.number : TEST_ALLOC_003 - * @tc.name : testAlloc003 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(10).fill(buffer); - */ - it("testAlloc003", 0, function () { - let buf1 = buffer.alloc(10); - let buf = buffer.alloc(10).fill(buf1); - expect(buf.length).assertEqual(10); - }); - - /** - * @tc.number : TEST_ALLOC_004 - * @tc.name : testAlloc004 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(0); - */ - it("testAlloc004", 0, function () { - let buf = buffer.alloc(0); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_ALLOC_005 - * @tc.name : testAlloc005 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(0).fill(string, encode); - */ - it("testAlloc005", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.alloc(0).fill("ab$#", undefined, undefined, encode); - expect(buf.length).assertEqual(0); - } - }); - - /** - * @tc.number : TEST_ALLOC_006 - * @tc.name : testAlloc006 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(0).fill(buffer); - */ - it("testAlloc006", 0, function () { - let buf1 = buffer.alloc(10); - let buf = buffer.alloc(0).fill(buf1); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_ALLOC_007 - * @tc.name : testAlloc007 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(-5); - */ - it("testAlloc007", 0, function () { - try { - let buf = buffer.alloc(-5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The type of "size" must be number and the value cannot be negative. Received value is: -5'); - } - }); - - /** - * @tc.number : TEST_ALLOC_008 - * @tc.name : testAlloc008 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(10, string, encode); - */ - it("testAlloc008", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.alloc(10, "ab$#", encode); - expect(buf.length).assertEqual(10); - } - }); - - /** - * @tc.number : TEST_ALLOC_009 - * @tc.name : testAlloc009 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(0).fill(string, encode); - */ - it("testAlloc009", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.alloc(0, "ab$#", encode); - expect(buf.length).assertEqual(0); - } - }); - - /** - * @tc.number : TEST_ALLOC_010 - * @tc.name : testAlloc010 - * @tc.desc : Allocates a new Buffer for a fixed size bytes. If fill is undefined, the Buffer will be zero-filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(5.5); - */ - it("testAlloc010", 0, function () { - let buf = buffer.alloc(5.5); - expect(buf.length).assertEqual(5); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_001 - * @tc.name : testAllocUninitialized001 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitialized(10); - */ - it("testAllocUninitialized001", 0, function () { - let buf = buffer.allocUninitialized(10); - expect(buf.length).assertEqual(10); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_002 - * @tc.name : testAllocUninitialized002 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitialized(0); - */ - it("testAllocUninitialized002", 0, function () { - let buf = buffer.allocUninitialized(0); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_003 - * @tc.name : testAllocUninitialized003 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitialized(-5); - */ - it("testAllocUninitialized003", 0, function () { - try { - let buf = buffer.allocUninitialized(-5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The type of "size" must be number and the value cannot be negative. Received value is: -5'); - } - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_001 - * @tc.name : testAllocUninitializedFromPool001 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(10); - */ - it("testAllocUninitializedFromPool001", 0, function () { - let buf = buffer.allocUninitializedFromPool(10); - expect(buf.length).assertEqual(10); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_002 - * @tc.name : testAllocUninitializedFromPool002 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(10); - */ - it("testAllocUninitializedFromPool002", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.allocUninitializedFromPool(10).fill("abcd", undefined, undefined, encode); - expect(buf.length).assertEqual(10); - } - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_003 - * @tc.name : testAllocUninitializedFromPool003 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(10).fill(buffer); - */ - it("testAllocUninitializedFromPool003", 0, function () { - let buf1 = buffer.allocUninitializedFromPool(10); - let buf = buffer.allocUninitializedFromPool(10).fill(buf1); - expect(buf.length).assertEqual(10); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_004 - * @tc.name : testAllocUninitializedFromPool004 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(0); - */ - it("testAllocUninitializedFromPool004", 0, function () { - let buf = buffer.allocUninitializedFromPool(0); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_005 - * @tc.name : testAllocUninitializedFromPool005 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(0).fill(string, encode); - */ - it("testAllocUninitializedFromPool005", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let buf = buffer.allocUninitializedFromPool(0).fill("abcd", undefined, undefined, encode); - expect(buf.length).assertEqual(0); - } - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_006 - * @tc.name : testAllocUninitializedFromPool006 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(10).fill(buffer); - */ - it("testAllocUninitializedFromPool006", 0, function () { - let buf1 = buffer.allocUninitializedFromPool(10); - let buf = buffer.allocUninitializedFromPool(0).fill(buf1); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_007 - * @tc.name : testAllocUninitializedFromPool007 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(-5); - */ - it("testAllocUninitializedFromPool007", 0, function () { - try { - let buf = buffer.allocUninitializedFromPool(-5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The type of "size" must be number and the value cannot be negative. Received value is: -5'); - } - }); - - /** - * @tc.number : TEST_ALLOC_UNINITIALIZED_FROM_POOL_008 - * @tc.name : testAllocUninitializedFromPool008 - * @tc.desc : Allocates a new un-pooled Buffer for a fixed size bytes. The Buffer will not be initially filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.allocUninitializedFromPool(5.5); - */ - it("testAllocUninitializedFromPool008", 0, function () { - let buf = buffer.allocUninitializedFromPool(5.5); - expect(buf.length).assertEqual(5); - }); - - /** - * @tc.number : TEST_BYTE_LENGTH_001 - * @tc.name : testByteLength001 - * @tc.desc : Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`], which does not account - * for the encoding that is used to convert the string into bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.byteLength("abcd"); - */ - it("testByteLength001", 0, function () { - let byteLen = buffer.byteLength("abcd"); - expect(byteLen).assertEqual(4); - }); - - /** - * @tc.number : TEST_BYTE_LENGTH_002 - * @tc.name : testByteLength002 - * @tc.desc : Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`], which does not account - * for the encoding that is used to convert the string into bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.byteLength("测试"); - */ - it("testByteLength002", 0, function () { - let byteLen = buffer.byteLength("测试"); - expect(byteLen).assertEqual(6); - }); - - /** - * @tc.number : TEST_BYTE_LENGTH_003 - * @tc.name : testByteLength003 - * @tc.desc : Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`], which does not account - * for the encoding that is used to convert the string into bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.byteLength("$&@*%"); - */ - it("testByteLength003", 0, function () { - let byteLen = buffer.byteLength("$&@*%"); - expect(byteLen).assertEqual(5); - }); - - /** - * @tc.number : TEST_BYTE_LENGTH_004 - * @tc.name : testByteLength004 - * @tc.desc : Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`], which does not account - * for the encoding that is used to convert the string into bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.byteLength(string, encode); - */ - it("testByteLength004", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - let result = [4, 4, 8, 8, 4, 4, 4, 8, 3, 3, 2]; - for (let i = 0, len = encodeArr.length; i < len; i++) { - let byteLen = buffer.byteLength("abcd", encodeArr[i]); - expect(byteLen).assertEqual(result[i]); - } - }); - - /** - * @tc.number : TEST_BYTE_LENGTH_005 - * @tc.name : testByteLength005 - * @tc.desc : Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`], which does not account - * for the encoding that is used to convert the string into bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.byteLength(arrayBuffer); - */ - it("testByteLength005", 0, function () { - let uintarr = new Uint8Array(2); - uintarr[0] = 21; - uintarr[1] = 31; - let byteLen = buffer.byteLength(uintarr.buffer); - expect(byteLen).assertEqual(2); - }); - - /** - * @tc.number : TEST_CONCAT_001 - * @tc.name : testConcat001 - * @tc.desc : Returns a new `Buffer` which is the result of concatenating - * all the `Buffer`instances in the `list` together. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("1236"); - * let buf2 = buffer.from("1235"); - * let buf = buffer.concat([buf1, buf2]); - */ - it("testConcat001", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - let buf = buffer.concat([buf1, buf2]); - let str = buf.toString(); - expect(str).assertEqual("12361235"); - }); - - /** - * @tc.number : TEST_CONCAT_002 - * @tc.name : testConcat002 - * @tc.desc : Returns a new `Buffer` which is the result of concatenating - * all the `Buffer`instances in the `list` together. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("测试"); - * let buf2 = buffer.from("$&*"); - * let buf = buffer.concat([buf1, buf2]); - */ - it("testConcat002", 0, function () { - let buf1 = buffer.from("测试"); - let buf2 = buffer.from("$&*"); - let buf = buffer.concat([buf1, buf2]); - let str = buf.toString(); - expect(str).assertEqual("测试$&*"); - }); - - /** - * @tc.number : TEST_CONCAT_003 - * @tc.name : testConcat003 - * @tc.desc : Returns a new `Buffer` which is the result of concatenating - * all the `Buffer`instances in the `list` together. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("123$"); - * let buf2 = buffer.from("*35"); - * let buf = buffer.concat([buf1, buf2]); - */ - it("testConcat003", 0, function () { - let buf1 = buffer.from("123$"); - let buf2 = buffer.from("*35"); - let buf3 = buffer.concat([buf1, buf2]); - let buf = buffer.alloc(5).fill(buf3); - let str = buf.toString(); - expect(str).assertEqual("123$*"); - }); - - /** - * @tc.number : TEST_CONCAT_004 - * @tc.name : testConcat004 - * @tc.desc : Returns a new `Buffer` which is the result of concatenating - * all the `Buffer`instances in the `list` together. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("123$"); - * let buf2 = buffer.from("*35"); - * let buf = buffer.concat([buf1, buf2]); - */ - it("testConcat004", 0, function () { - let buf1 = buffer.from("123$"); - let buf2 = buffer.from("*35"); - try { - let buf = buffer.concat([buf1, buf2], -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "totalLength" is out of range. It must be >= 0 and <= 4294967296. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_FROM_001 - * @tc.name : testFrom001 - * @tc.desc : Copies the passed buffer data onto a new Buffer instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(uint8Array); - */ - it("testFrom001", 0, function () { - let uarr = new Uint8Array(3); - uarr[0] = 0x12; - uarr[1] = 0x34; - uarr[2] = 0x56; - let buf = buffer.from(uarr); - let str = buf.toString("hex"); - expect(str).assertEqual("123456"); - }); - - /** - * @tc.number : TEST_FROM_002 - * @tc.name : testFrom002 - * @tc.desc : Allocates a new Buffer using an array of bytes in the range 0 – 255. - * Array entries outside that range will be truncated to fit into it. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(array); - */ - it("testFrom002", 0, function () { - const buf = buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); - let str = buf.toString("hex"); - expect(str).assertEqual("627566666572"); - }); - - /** - * @tc.number : TEST_FROM_003 - * @tc.name : testFrom003 - * @tc.desc : This creates a view of the ArrayBuffer without copying the underlying memory. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(arrayBuffer); - */ - it("testFrom003", 0, function () { - const arr = new Uint8Array(2); - arr[0] = 97; - arr[1] = 98; - const buf = buffer.from(arr.buffer); - arr[0] = 99; - buf[1] = 100; - let str = buf.toString("hex"); - expect(str).assertEqual("6364"); - expect(arr[1]).assertEqual(100); - }); - - /** - * @tc.number : TEST_FROM_004 - * @tc.name : testFrom004 - * @tc.desc : This creates a view of the ArrayBuffer without copying the underlying memory. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(arrayBuffer, byteOffset); - */ - it("testFrom004", 0, function () { - const arr = new Uint8Array(2); - arr[0] = 97; - arr[1] = 98; - const buf = buffer.from(arr.buffer, 1); - buf[0] = 99; - buf[1] = 100; - let str = buf.toString("hex"); - expect(str).assertEqual("63"); - expect(arr[1]).assertEqual(99); - expect(buf[0]).assertEqual(99); - expect(buf[1]).assertEqual(undefined); - }); - - /** - * @tc.number : TEST_FROM_005 - * @tc.name : testFrom005 - * @tc.desc : This creates a view of the ArrayBuffer without copying the underlying memory. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer2.from(buffer1); - */ - it("testFrom005", 0, function () { - const buf1 = buffer.from("buffer"); - const buf2 = buffer.from(buf1); - buf1[0] = 0x61; - let str = buf1.toString(); - expect(str).assertEqual("auffer"); - str = buf2.toString(); - expect(str).assertEqual("buffer"); - }); - - /** - * @tc.number : TEST_FROM_006 - * @tc.name : testFrom006 - * @tc.desc : This creates a view of the ArrayBuffer without copying the underlying memory. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(string); - */ - it("testFrom006", 0, function () { - const buf1 = buffer.from("this is a test"); - let str = buf1.toString(); - expect(str).assertEqual("this is a test"); - }); - - /** - * @tc.number : TEST_FROM_007 - * @tc.name : testFrom007 - * @tc.desc : Creates a new Buffer containing string. The encoding parameter identifies the character encoding - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(string, encoding); - */ - it("testFrom007", 0, function () { - const buf1 = buffer.from("F1刘FG", "hex"); - let str = buf1.toString("hex"); - expect(str).assertEqual("f1"); - - let buf2 = buffer.from("F1FG", "ascii"); - str = buf2.toString("ascii"); - expect(str).assertEqual("F1FG"); - - let buf3 = buffer.from("F1FG刘", "base64"); - str = buf3.toString("base64"); - expect(str).assertEqual("F1FG"); - - let buf4 = buffer.from("F1FG刘", "base64url"); - str = buf4.toString("base64url"); - expect(str).assertEqual("F1FG"); - - let buf5 = buffer.from("F1FG", "binary"); - str = buf5.toString("binary"); - expect(str).assertEqual("F1FG"); - - let buf6 = buffer.from("F1FG", "latin1"); - str = buf6.toString("latin1"); - expect(str).assertEqual("F1FG"); - - let buf7 = buffer.from("F1FG刘", "ucs2"); - str = buf7.toString("ucs2"); - expect(str).assertEqual("F1FG刘"); - - let buf8 = buffer.from("F1FG刘", "utf16le"); - str = buf8.toString("utf16le"); - expect(str).assertEqual("F1FG刘"); - - let buf9 = buffer.from("F1FG刘", "ucs2"); - str = buf9.toString("ucs2"); - expect(str).assertEqual("F1FG刘"); - - let buf10 = buffer.from("F1FG刘", "utf-8"); - str = buf10.toString("utf-8"); - expect(str).assertEqual("F1FG刘"); - - let buf11 = buffer.from("F1FG刘", "utf8"); - str = buf11.toString("utf8"); - expect(str).assertEqual("F1FG刘"); - }); - - /** - * @tc.number : TEST_FROM_008 - * @tc.name : testFrom008 - * @tc.desc : For the object whose value returned by valueof() function is strictly equal to object - * or supports symbol To primitive object, a new buffer instance is created. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(object); - */ - it("testFrom008", 0, function () { - const buf = buffer.from(new String("this is a test")); - let str = buf.toString(); - expect(str).assertEqual("this is a test"); - }); - - /** - * @tc.number : TEST_FROM_009 - * @tc.name : testFrom009 - * @tc.desc : For the object whose value returned by valueof() function is strictly equal to object - * or supports symbol To primitive object, a new buffer instance is created. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.from(object); - */ - it("testFrom009", 0, function () { - const buf = buffer.from(new String("this is a test"), "utf8", 14); - let str = buf.toString(); - expect(str).assertEqual("this is a test"); - }); - - /** - * @tc.number : TEST_IS_BUFFER_001 - * @tc.name : testIsBuffer001 - * @tc.desc : Returns true if obj is a Buffer, false otherwise - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isBuffer(buf); - */ - it("testIsBuffer001", 0, function () { - let buf = buffer.alloc(1); - let flag = buffer.isBuffer(buf); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_IS_BUFFER_002 - * @tc.name : testIsBuffer002 - * @tc.desc : Returns true if obj is a Buffer, false otherwise - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isBuffer(buf); - */ - it("testIsBuffer002", 0, function () { - let obj = new Object(1); - let flag = buffer.isBuffer(obj); - expect(flag).assertEqual(false); - }); - - /** - * @tc.number : TEST_IS_ENCODING_001 - * @tc.name : testIsEncoding001 - * @tc.desc : Returns true if encoding is the name of a supported character encoding, or false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isEncoding("utf8"); - */ - it("testIsEncoding001", 0, function () { - let flag = buffer.isEncoding("utf8"); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_IS_ENCODING_002 - * @tc.name : testIsEncoding002 - * @tc.desc : Returns true if encoding is the name of a supported character encoding, or false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isEncoding(encode); - */ - it("testIsEncoding002", 0, function () { - let encodeArr = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "utf-16le", "base64", "base64url", "hex"]; - for (const encode of encodeArr) { - let flag = buffer.isEncoding(encode); - expect(flag).assertEqual(true); - } - }); - - /** - * @tc.number : TEST_IS_ENCODING_003 - * @tc.name : testIsEncoding003 - * @tc.desc : Returns true if encoding is the name of a supported character encoding, or false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isEncoding('gbk'); - */ - it("testIsEncoding003", 0, function () { - let flag = buffer.isEncoding("gbk"); - expect(flag).assertEqual(false); - }); - - /** - * @tc.number : TEST_COMPARE_001 - * @tc.name : testCompare001 - * @tc.desc : Compares buf with target and returns a number indicating whether buf comes before, after, - * or is the same as target in sort order. Comparison is based on the actual sequence of - * bytes in each Buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.isEncoding('gbk'); - */ - it("testCompare001", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - let res = buffer.compare(buf1, buf2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number : TEST_TRANSCODE_001 - * @tc.name : testTranscode001 - * @tc.desc : Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.transcode(buf1, "ascii", "ucs2"); - */ - it("testTranscode001", 0, function () { - let buf1 = buffer.from("1236"); - let buf = buffer.transcode(buf1, "ascii", "ucs2"); - let str = buf.toString("ucs2"); - expect(str).assertEqual("1236"); - }); - - /** - * @tc.number : TEST_TRANSCODE_002 - * @tc.name : testTranscode002 - * @tc.desc : Re-encodes the given Buffer or Uint8Array instance from one character encoding to another. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.transcode(buf1, "ascii", "ucs2"); - */ - it("testTranscode002", 0, function () { - let buf1 = buffer.from("测试"); - let buf = buffer.transcode(buf1, "utf8", "ucs2"); - let str = buf.toString("ucs2"); - expect(str).assertEqual("测试"); - }); - - /** - * @tc.number : TEST_FILL_001 - * @tc.name : testFill001 - * @tc.desc : Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(3).fill("abc"); - */ - it("testFill001", 0, function () { - let buf = buffer.alloc(3).fill("abc"); - let str = buf.toString(); - expect(str).assertEqual("abc"); - }); - - /** - * @tc.number : TEST_FILL_002 - * @tc.name : testFill002 - * @tc.desc : Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(10).fill('F1刘FG', 0, 10, 'hex'); - */ - it("testFill002", 0, function () { - const buf1 = buffer.alloc(10).fill("F1刘FG", 0, 10, "hex"); - let str = buf1.toString("hex"); - expect(str).assertEqual("f1f1f1f1f1f1f1f1f1f1"); - - let buf2 = buffer.alloc(10).fill("F1刘FG", 0, 10, "ascii"); - str = buf2.toString("hex"); - expect(str).assertEqual("46311846474631184647"); - - let buf3 = buffer.alloc(10).fill("F1FG", 0, 10, "base64"); - str = buf3.toString("hex"); - expect(str).assertEqual("17514617514617514617"); - - let buf4 = buffer.alloc(10).fill("F1刘FG", 0, 10, "binary"); - str = buf4.toString("hex"); - expect(str).assertEqual("46311846474631184647"); - - let buf5 = buffer.alloc(10).fill("F1刘FG", 0, 10, "latin1"); - str = buf5.toString("hex"); - expect(str).assertEqual("46311846474631184647"); - - let buf6 = buffer.alloc(10).fill("F1刘FG", 0, 10, "ucs2"); - str = buf6.toString("hex"); - expect(str).assertEqual("46003100185246004700"); - - let buf7 = buffer.alloc(10).fill("F1刘FG", 0, 10, "utf8"); - str = buf7.toString("hex"); - expect(str).assertEqual("4631e5889846474631e5"); - }); - - /** - * @tc.number : TEST_FILL_003 - * @tc.name : testFill003 - * @tc.desc : Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(3).fill("$*$"); - */ - it("testFill003", 0, function () { - let buf = buffer.alloc(3).fill("$*$"); - let str = buf.toString(); - expect(str).assertEqual("$*$"); - }); - - /** - * @tc.number : TEST_FILL_004 - * @tc.name : testFill004 - * @tc.desc : Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(3).fill("$*$"); - */ - it("testFill004", 0, function () { - try { - let buf = buffer.alloc(3).fill("$*$", -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 4294967296. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_FILL_005 - * @tc.name : testFill005 - * @tc.desc : Fills buf with the specified value. If the offset and end are not given, the entire buf will be filled. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buffer.alloc(3).fill("$*$", 0, 5); - */ - it("testFill005", 0, function () { - try { - let buf = buffer.alloc(3).fill("$*$", 0, 5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "end" is out of range. It must be >= 0 and <= 3. Received value is: 5'); - } - }); - - /** - * @tc.number : TEST_COMPARE_002 - * @tc.name : testCompare002 - * @tc.desc : Compares buf with target and returns a number indicating whether buf comes before, after, - * or is the same as target in sort order. Comparison is based on the actual sequence of - * bytes in each Buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.compare(buf2); - */ - it("testCompare002", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - let res = buf1.compare(buf2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number : TEST_COMPARE_003 - * @tc.name : testCompare003 - * @tc.desc : Compares buf with target and returns a number indicating whether buf comes before, after, - * or is the same as target in sort order. Comparison is based on the actual sequence of - * bytes in each Buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.compare(buf2, -1); - */ - it("testCompare003", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - try { - let res = buf1.compare(buf2, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "targetStart" is out of range. It must be >= 0 and <= 4294967296. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_COPY_001 - * @tc.name : testCopy001 - * @tc.desc : Copies data from a region of buf to a region in target, - * even if the target memory region overlaps with buf. - * If sourceEnd is greater than the length of the target, the length of the target shall prevail, - * and the extra part will not be overwritten. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.copy(buf2); - */ - it("testCopy001", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - let num = buf1.copy(buf2); - expect(num).assertEqual(4); - let str = buf2.toString(); - expect(str).assertEqual("1236"); - }); - - /** - * @tc.number : TEST_COPY_002 - * @tc.name : testCopy002 - * @tc.desc : Copies data from a region of buf to a region in target, - * even if the target memory region overlaps with buf. - * If sourceEnd is greater than the length of the target, the length of the target shall prevail, - * and the extra part will not be overwritten. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.copy(buf2, targetStart, sourceStart, sourceEnd); - */ - it("testCopy002", 0, function () { - let buf1 = buffer.from("abcdefg"); - let buf2 = buffer.from("1235789"); - let num = buf1.copy(buf2, 2, 1, 3); - expect(num).assertEqual(2); - let str = buf2.toString(); - expect(str).assertEqual("12bc789"); - }); - - /** - * @tc.number : TEST_COPY_003 - * @tc.name : testCopy003 - * @tc.desc : Copies data from a region of buf to a region in target, - * even if the target memory region overlaps with buf. - * If sourceEnd is greater than the length of the target, the length of the target shall prevail, - * and the extra part will not be overwritten. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.copy(buf2); - */ - it("testCopy003", 0, function () { - let buf1 = buffer.from("123656"); - let buf2 = buffer.from("1235"); - let num = buf1.copy(buf2); - expect(num).assertEqual(4); - let str = buf2.toString(); - expect(str).assertEqual("1236"); - }); - - /** - * @tc.number : TEST_COPY_004 - * @tc.name : testCopy004 - * @tc.desc : Copies data from a region of buf to a region in target, - * even if the target memory region overlaps with buf. - * If sourceEnd is greater than the length of the target, the length of the target shall prevail, - * and the extra part will not be overwritten. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.copy(buf2); - */ - it("testCopy004", 0, function () { - let buf1 = buffer.from("123656"); - let buf2 = buffer.from("1235"); - try { - let num = buf1.copy(buf2, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "targetStart" is out of range. It must be >= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_COPY_005 - * @tc.name : testCopy005 - * @tc.desc : Copies data from a region of buf to a region in target, - * even if the target memory region overlaps with buf. - * If sourceEnd is greater than the length of the target, the length of the target shall prevail, - * and the extra part will not be overwritten. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.copy(buf2); - */ - it("testCopy005", 0, function () { - let buf1 = buffer.from("ab$#"); - let buf2 = buffer.from("123556"); - let num = buf1.copy(buf2); - expect(num).assertEqual(4); - let str = buf2.toString(); - expect(str).assertEqual("ab$#56"); - }); - - /** - * @tc.number : TEST_BUFFER_LENGTH_001 - * @tc.name : testBufferLength001 - * @tc.desc : Returns the number of bytes in buf. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : level 0 - */ - it("testBufferLength001", 0, function () { - let buf = buffer.from("1236"); - let len = buf.length; - expect(len).assertEqual(4); - }); - - /** - * @tc.number : TEST_BUFFER_BYTE_OFFSET_001 - * @tc.name : testBufferByteOffset001 - * @tc.desc : Returns the number of bytes in buf. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : level 0 - */ - it("testBufferByteOffset001", 0, function () { - let buf = buffer.from("1236"); - let offset = buf.byteOffset; - expect(offset >= 0).assertTrue(); - }); - - /** - * @tc.number : TEST_BUFFER_BUFFER_001 - * @tc.name : testBufferBuffer001 - * @tc.desc : Returns the number of bytes in buf. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : level 0 - */ - it("testBufferBuffer001", 0, function () { - let buf = buffer.from("1236"); - console.info(typeof buf.buffer); - expect(buf.buffer != null).assertTrue(); - }); - - /** - * @tc.number : TEST_EQUALS_001 - * @tc.name : testEquals001 - * @tc.desc : Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.equals(buf2); - */ - it("testEquals001", 0, function () { - let buf1 = buffer.from("1236"); - let buf2 = buffer.from("1235"); - let res = buf1.equals(buf2); - expect(res).assertEqual(false); - }); - - /** - * @tc.number : TEST_EQUALS_002 - * @tc.name : testEquals002 - * @tc.desc : Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.equals(buf2); - */ - it("testEquals002", 0, function () { - let buf1 = buffer.from("1236测试"); - let buf2 = buffer.from("1236测试"); - let res = buf1.equals(buf2); - expect(res).assertEqual(true); - }); - - /** - * @tc.number : TEST_EQUALS_003 - * @tc.name : testEquals003 - * @tc.desc : Returns true if both buf and otherBuffer have exactly the same bytes, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.equals(buf2); - */ - it("testEquals003", 0, function () { - let buf1 = buffer.from("O@O"); - let buf2 = buffer.from("O^O"); - let res = buf1.equals(buf2); - expect(res).assertEqual(false); - }); - - /** - * @tc.number : TEST_INCLUDES_001 - * @tc.name : testIncludes001 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("3"); - */ - it("testIncludes001", 0, function () { - let buf1 = buffer.from("13236"); - let flag = buf1.includes("3"); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_INCLUDES_002 - * @tc.name : testIncludes002 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("3", 2); - */ - it("testIncludes002", 0, function () { - let buf1 = buffer.from("13236"); - let flag = buf1.includes("3", 2); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_INCLUDES_003 - * @tc.name : testIncludes003 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("32"); - */ - it("testIncludes003", 0, function () { - let buf1 = buffer.from("13236"); - let flag = buf1.includes("32"); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_INCLUDES_004 - * @tc.name : testIncludes004 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("32"); - */ - it("testIncludes004", 0, function () { - let buf1 = buffer.from("13236"); - let flag = buf1.includes("32", 2); - expect(flag).assertEqual(false); - }); - - /** - * @tc.number : TEST_INCLUDES_005 - * @tc.name : testIncludes005 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("32"); - */ - it("testIncludes005", 0, function () { - let buf1 = buffer.from("测试特殊字符$#@!"); - let flag = buf1.includes("#@"); - expect(flag).assertEqual(true); - flag = buf1.includes("测试"); - expect(flag).assertEqual(true); - }); - - /** - * @tc.number : TEST_INCLUDES_006 - * @tc.name : testIncludes006 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.includes("32"); - */ - it("testIncludes006", 0, function () { - let buf1 = buffer.from("13236"); - let flag = buf1.includes("abc"); - expect(flag).assertEqual(false); - }); - - /** - * @tc.number : TEST_INDEX_OF_001 - * @tc.name : testIndexOf001 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.indexOf("3"); - */ - it("testIndexOf001", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.indexOf("3"); - expect(index).assertEqual(1); - }); - - /** - * @tc.number : TEST_INDEX_OF_002 - * @tc.name : testIndexOf002 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.indexOf("3"); - */ - it("testIndexOf002", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.indexOf("3", 2); - expect(index).assertEqual(3); - }); - - /** - * @tc.number : TEST_INDEX_OF_003 - * @tc.name : testIndexOf003 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let index = buf1.indexOf(value); - */ - it("testIndexOf003", 0, function () { - let buf1 = buffer.from("13236235"); - let index = buf1.indexOf("23"); - expect(index).assertEqual(2); - }); - - /** - * @tc.number : TEST_INDEX_OF_004 - * @tc.name : testIndexOf004 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let index = buf1.indexOf(value); - */ - it("testIndexOf004", 0, function () { - let buf1 = buffer.from("测试特殊字符$#@!"); - let index = buf1.indexOf("@"); - expect(index).assertEqual(20); - }); - - /** - * @tc.number : TEST_INDEX_OF_005 - * @tc.name : testIndexOf005 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let index = buf1.indexOf(value, byteOffset); - */ - it("testIndexOf005", 0, function () { - let buf1 = buffer.from("13236235"); - let index = buf1.indexOf("23", 3); - expect(index).assertEqual(5); - }); - - /** - * @tc.number : TEST_INDEX_OF_006 - * @tc.name : testIndexOf006 - * @tc.desc : The index of the first occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.indexOf("a"); - */ - it("testIndexOf006", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.indexOf("a"); - expect(index).assertEqual(-1); - }); - - /** - * @tc.number : TEST_KEYS_001 - * @tc.name : testKeys001 - * @tc.desc : Creates and returns an iterator of buf keys (indices). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.keys(); - */ - it("testKeys001", 0, function () { - let buf1 = buffer.from("1234"); - let keys = buf1.keys(); - let index = 0; - for (const key of keys) { - expect(key).assertEqual(index); - index++; - } - }); - - /** - * @tc.number : TEST_KEYS_002 - * @tc.name : testKeys002 - * @tc.desc : Creates and returns an iterator of buf keys (indices). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.keys(); - */ - it("testKeys002", 0, function () { - let uarr = new Uint8Array(4); - uarr[0] = 0x31; - uarr[1] = 0x32; - uarr[2] = 0x33; - uarr[3] = 0x34; - let buf1 = buffer.from(uarr); - let keys = buf1.keys(); - let index = 0; - for (const key of keys) { - expect(key).assertEqual(index); - index++; - } - }); - - /** - * @tc.number : TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Creates and returns an iterator for buf values (bytes). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.values(); - */ - it("testValues001", 0, function () { - let buf1 = buffer.from("1234"); - let keys = buf1.values(); - let va = 49; - for (const value of keys) { - expect(value).assertEqual(va); - va++; - } - }); - - /** - * @tc.number : TEST_VALUES_002 - * @tc.name : testValues002 - * @tc.desc : Creates and returns an iterator for buf values (bytes). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.values(); - */ - it("testValues002", 0, function () { - let uarr = new Uint8Array(4); - uarr[0] = 0x31; - uarr[1] = 0x32; - uarr[2] = 0x33; - uarr[3] = 0x34; - let buf1 = buffer.from(uarr); - let keys = buf1.values(); - let va = 0x31; - for (const value of keys) { - expect(value).assertEqual(va); - va++; - } - }); - - /** - * @tc.number : TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Creates and returns an iterator of [index, byte] pairs from the contents of buf - * which is contructed from an Uint8Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.entries(); - */ - it("testEntries001", 0, function () { - let buf1 = buffer.from("1234"); - let entries = buf1.entries(); - let va = 49, - index = 0; - for (const [key, value] of entries) { - expect(key).assertEqual(index); - expect(value).assertEqual(va); - va++; - index++; - } - }); - - /** - * @tc.number : TEST_ENTRIES_002 - * @tc.name : testEntries002 - * @tc.desc : Creates and returns an iterator of [index, byte] pairs from the contents of buf - * which is contructed from an Uint8Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.entries(); - */ - it("testEntries002", 0, function () { - let uarr = new Uint8Array(4); - uarr[0] = 0x31; - uarr[1] = 0x32; - uarr[2] = 0x33; - uarr[3] = 0x34; - let buf1 = buffer.from(uarr); - let entries = buf1.entries(); - let va = 49, - index = 0; - for (const [key, value] of entries) { - expect(key).assertEqual(index); - expect(value).assertEqual(va); - va++; - index++; - } - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_001 - * @tc.name : testLastIndexOf001 - * @tc.desc : The index of the last occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.lastIndexOf("3"); - */ - it("testLastIndexOf001", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.lastIndexOf("3"); - expect(index).assertEqual(3); - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_002 - * @tc.name : testLastIndexOf002 - * @tc.desc : The index of the last occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.lastIndexOf("3", 2); - */ - it("testLastIndexOf002", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.lastIndexOf("3", 2); - expect(index).assertEqual(1); - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_003 - * @tc.name : testLastIndexOf003 - * @tc.desc : The index of the last occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236235"); buf1.lastIndexOf("23"); - */ - it("testLastIndexOf003", 0, function () { - let buf1 = buffer.from("13236235"); - let index = buf1.lastIndexOf("23"); - expect(index).assertEqual(5); - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_004 - * @tc.name : testLastIndexOf004 - * @tc.desc : The index of the last occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236235"); buf1.lastIndexOf("23", 3); - */ - it("testLastIndexOf004", 0, function () { - let buf1 = buffer.from("13236235"); - let index = buf1.lastIndexOf("23", 3); - expect(index).assertEqual(2); - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_005 - * @tc.name : testLastIndexOf005 - * @tc.desc : The index of the last occurrence of value in buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf1 = buffer.from("13236"); buf1.lastIndexOf("a"); - */ - it("testLastIndexOf005", 0, function () { - let buf1 = buffer.from("13236"); - let index = buf1.lastIndexOf("a"); - expect(index).assertEqual(-1); - }); - - /** - * @tc.number : TEST_LAST_INDEX_OF_006 - * @tc.name : testLastIndexOf006 - * @tc.desc : Returns true if value was found in buf, false otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let buf = buffer.from("13236"); buf.lastIndexOf("a", 0, "utf8"); - */ - it("testLastIndexOf006", 0, function () { - let encodeArr: BufferEncoding[] = ["utf8", "utf-8", "ucs2", "ucs-2", "ascii", "latin1", "binary", "utf16le", "base64", "base64url", "hex"]; - let buf = buffer.from("13236"); - for (const encode of encodeArr) { - let index = buf.lastIndexOf("ab", 0, encode); - expect(index).assertEqual(-1); - } - }); - - /** - * @tc.number : TEST_READ_BIG_INT_64_BE_001 - * @tc.name : testReadBigInt64BE001 - * @tc.desc : Reads a signed, big-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigInt64BE001", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x79, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - const result = buf.readBigInt64BE(0).toString(16); - expect(result).assertEqual("6364656667686979"); - }); - - /** - * @tc.number : TEST_READ_BIG_INT_64_BE_002 - * @tc.name : testReadBigInt64BE002 - * @tc.desc : Reads a signed, big-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigInt64BE002", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - try { - let ref = buf.readBigInt64BE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_BIG_INT_64_LE_001 - * @tc.name : testReadBigInt64LE001 - * @tc.desc : Reads a signed, little-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigInt64LE001", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - let ref = buf.readBigInt64LE(0).toString(16); - expect(ref).assertEqual("7069686766656463"); - }); - - /** - * @tc.number : TEST_READ_BIG_INT_64_LE_002 - * @tc.name : testReadBigInt64LE002 - * @tc.desc : Reads a signed, little-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigInt64LE002", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - try { - let ref = buf.readBigInt64LE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_BIG_U_INT_64_BE_001 - * @tc.name : testReadBigUInt64BE001 - * @tc.desc : Reads a unsigned, big-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigUInt64BE001", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - let ref = buf.readBigUInt64BE(0).toString(16); - expect(ref).assertEqual("6364656667686970"); - }); - - /** - * @tc.number : TEST_READ_BIG_U_INT_64_BE_002 - * @tc.name : testReadBigUInt64BE002 - * @tc.desc : Reads a unsigned, big-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigUInt64BE002", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - try { - let ref = buf.readBigUInt64BE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_BIG_U_INT_64_LE_001 - * @tc.name : testReadBigUInt64LE001 - * @tc.desc : Reads a unsigned, little-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigUInt64LE001", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - let ref = buf.readBigUInt64LE(0).toString(16); - expect(ref).assertEqual("7069686766656463"); - }); - - /** - * @tc.number : TEST_READ_BIG_U_INT_64_LE_002 - * @tc.name : testReadBigUInt64LE002 - * @tc.desc : Reads a unsigned, little-endian 64-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadBigUInt64LE002", 0, function () { - let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78]); - try { - let ref = buf.readBigUInt64LE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_DOUBLE_BE_001 - * @tc.name : testReadDoubleBE001 - * @tc.desc : Reads a 64-bit, big-endian double from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadDoubleBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - buf.writeDoubleBE(123.456, 0); - let ref = buf.readDoubleBE(); - expect(ref).assertEqual(123.456); - }); - - /** - * @tc.number : TEST_READ_DOUBLE_BE_002 - * @tc.name : testReadDoubleBE002 - * @tc.desc : Reads a 64-bit, big-endian double from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadDoubleBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - buf.writeDoubleBE(123.456, 0); - try { - let ref = buf.readDoubleBE(1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_DOUBLE_LE_001 - * @tc.name : testReadDoubleLE001 - * @tc.desc : Reads a 64-bit, little-endian double from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadDoubleLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - buf.writeDoubleLE(123.456, 0); - let ref = buf.readDoubleLE(); - expect(ref).assertEqual(123.456); - }); - - /** - * @tc.number : TEST_READ_DOUBLE_LE_002 - * @tc.name : testReadDoubleLE002 - * @tc.desc : Reads a 64-bit, little-endian double from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadDoubleLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - buf.writeDoubleLE(123.456, 0); - try { - let ref = buf.readDoubleLE(1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_FLOAT_BE_001 - * @tc.name : testReadFloatBE001 - * @tc.desc : Reads a 32-bit, big-endian float from buf at the specified offset. - * @tc.size : . - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadFloatBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeFloatBE(0xcabcbcbc, 0); - let ref = buf.readFloatBE(0).toString(16); - expect(ref).assertEqual("cabcbd00"); - }); - - /** - * @tc.number : TEST_READ_FLOAT_BE_002 - * @tc.name : testReadFloatBE002 - * @tc.desc : Reads a 32-bit, big-endian float from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadFloatBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeFloatBE(0xcabcbcbc, 0); - try { - let ref = buf.readFloatBE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_FLOAT_LE_001 - * @tc.name : testReadFloatLE001 - * @tc.desc : Reads a 32-bit, little-endian float from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadFloatLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeFloatLE(0xcabcbcbc, 0); - let ref = buf.readFloatLE(0).toString(16); - expect(ref).assertEqual("cabcbd00"); - }); - - /** - * @tc.number : TEST_READ_FLOAT_LE_002 - * @tc.name : testReadFloatLE002 - * @tc.desc : Reads a 32-bit, little-endian float from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadFloatLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeFloatLE(0xcabcbcbc, 0); - try { - let ref = buf.readFloatLE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_INT_8_001 - * @tc.name : testReadInt8001 - * @tc.desc : Reads a signed 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt8001", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - buf.writeInt8(0x12); - let ref = buf.readInt8(0).toString(16); - expect(ref).assertEqual("12"); - }); - - /** - * @tc.number : TEST_READ_INT_8_002 - * @tc.name : testReadInt8002 - * @tc.desc : Reads a signed 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt8002", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - buf.writeInt8(0x12); - try { - let ref = buf.readInt8(2).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: 2'); - } - }); - - /** - * @tc.number : TEST_READ_INT_16_BE_001 - * @tc.name : testReadInt16BE001 - * @tc.desc : Reads a signed, big-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt16BE001", 0, function () { - let buf = buffer.alloc(2); - buf.writeInt16BE(0x1234, 0); - let ref = buf.readInt16BE(0).toString(16); - expect(ref).assertEqual("1234"); - }); - - /** - * @tc.number : TEST_READ_INT_16_BE_002 - * @tc.name : testReadInt16BE002 - * @tc.desc : Reads a signed, big-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt16BE002", 0, function () { - let buf = buffer.alloc(2); - buf.writeInt16BE(0x1234, 0); - try { - let ref = buf.readInt16BE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_INT_16_LE_001 - * @tc.name : testReadInt16LE001 - * @tc.desc : Reads a signed, little-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt16LE001", 0, function () { - let buf = buffer.alloc(2); - buf.writeInt16BE(0x1234, 0); - let ref = buf.readInt16LE(0).toString(16); - expect(ref).assertEqual("3412"); - }); - - /** - * @tc.number : TEST_READ_INT_16_LE_002 - * @tc.name : testReadInt16LE002 - * @tc.desc : Reads a signed, little-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt16LE002", 0, function () { - let buf = buffer.alloc(2); - buf.writeInt16BE(0x1234, 0); - try { - let ref = buf.readInt16LE(1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_INT_32_BE_001 - * @tc.name : testReadInt32BE001 - * @tc.desc : Reads a signed, big-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt32BE001", 0, function () { - let buf = buffer.alloc(4); - buf.writeInt32BE(0x12345678, 0); - let ref = buf.readInt32BE(0).toString(16); - expect(ref).assertEqual("12345678"); - }); - - /** - * @tc.number : TEST_READ_INT_32_BE_002 - * @tc.name : testReadInt32BE002 - * @tc.desc : Reads a signed, big-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt32BE002", 0, function () { - let buf = buffer.alloc(4); - buf.writeInt32BE(0x12345678, 0); - try { - let ref = buf.readInt32BE(1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_INT_32_LE_001 - * @tc.name : testReadInt32LE001 - * @tc.desc : Reads a signed, little-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt32LE001", 0, function () { - let buf = buffer.alloc(4); - buf.writeInt32BE(0x12345678, 0); - let ref = buf.readInt32LE(0).toString(16); - expect(ref).assertEqual("78563412"); - }); - - /** - * @tc.number : TEST_READ_INT_32_LE_002 - * @tc.name : testReadInt32LE002 - * @tc.desc : Reads a signed, little-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadInt32LE002", 0, function () { - let buf = buffer.alloc(4); - buf.writeInt32BE(0x12345678, 0); - try { - let ref = buf.readInt32LE(1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_INT_BE_001 - * @tc.name : testReadIntBE001 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as a big-endian, two's complement signed value supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadIntBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - buf.writeIntBE(0x123456789011, 0, 6); - let ref = buf.readIntBE(0, 5).toString(16); - expect(ref).assertEqual("1234567890"); - }); - - /** - * @tc.number : TEST_READ_INT_BE_002 - * @tc.name : testReadIntBE002 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as a big-endian, two's complement signed value supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadIntBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - buf.writeIntBE(0x123456789011, 0, 6); - try { - let ref = buf.readIntBE(2, 5).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: 2'); - } - }); - - /** - * @tc.number : TEST_READ_INT_LE_001 - * @tc.name : testReadIntLE001 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as a little-endian, two's complement signed value supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadIntLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - buf.writeIntLE(0x123456789011, 0, 6); - let ref = buf.readIntLE(0, 5).toString(16); - expect(ref).assertEqual("3456789011"); - }); - - /** - * @tc.number : TEST_READ_INT_LE_002 - * @tc.name : testReadIntLE002 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as a little-endian, two's complement signed value supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadIntLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - buf.writeIntLE(0x123456789011, 0, 6); - try { - let ref = buf.readIntLE(2, 5).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: 2'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_8_001 - * @tc.name : testReadUInt8001 - * @tc.desc : Reads an unsigned 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt8001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt8(0x42); - let ref = buf.readUInt8(0).toString(16); - expect(ref).assertEqual("42"); - }); - - /** - * @tc.number : TEST_READ_U_INT_8_002 - * @tc.name : testReadUInt8002 - * @tc.desc : Reads an unsigned 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt8002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt8(0x42); - try { - let ref = buf.readUInt8(4).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 3. Received value is: 4'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_16_BE_001 - * @tc.name : testReadUInt16BE001 - * @tc.desc : Reads an unsigned, big-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt16BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt16BE(0x1234, 0); - let ref = buf.readUInt16BE(0).toString(16); - expect(ref).assertEqual("1234"); - }); - - /** - * @tc.number : TEST_READ_U_INT_16_BE_002 - * @tc.name : testReadUInt16BE002 - * @tc.desc : Reads an unsigned, big-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt16BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt16BE(0x1234, 0); - try { - let ref = buf.readUInt16BE(3).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 2. Received value is: 3'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_16_LE_001 - * @tc.name : testReadUInt16LE001 - * @tc.desc : Reads an unsigned, little-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt16LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt16LE(0x1234, 0); - let ref = buf.readUInt16LE(0).toString(16); - expect(ref).assertEqual("1234"); - }); - - /** - * @tc.number : TEST_READ_U_INT_16_LE_002 - * @tc.name : testReadUInt16LE002 - * @tc.desc : Reads an unsigned, little-endian 16-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt16LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt16LE(0x1234, 0); - try { - let ref = buf.readUInt16LE(3).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 2. Received value is: 3'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_32_BE_001 - * @tc.name : testReadUInt32BE001 - * @tc.desc : Reads an unsigned, big-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt32BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt32BE(0x12345678, 0); - let ref = buf.readUInt32BE(0).toString(16); - expect(ref).assertEqual("12345678"); - }); - - /** - * @tc.number : TEST_READ_U_INT_32_BE_002 - * @tc.name : testReadUInt32BE002 - * @tc.desc : Reads an unsigned, big-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt32BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt32BE(0x12345678, 0); - try { - let ref = buf.readUInt32BE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_32_LE_001 - * @tc.name : testReadUInt32LE001 - * @tc.desc : Reads an unsigned, little-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt32LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt32LE(0x12345678, 0); - let ref = buf.readUInt32LE(0).toString(16); - expect(ref).assertEqual("12345678"); - }); - - /** - * @tc.number : TEST_READ_U_INT_32_LE_002 - * @tc.name : testReadUInt32LE002 - * @tc.desc : Reads an unsigned, little-endian 32-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUInt32LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUInt32LE(0x12345678, 0); - try { - let ref = buf.readUInt32LE(1).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_BE_001 - * @tc.name : testReadUIntBE001 - * @tc.desc : Reads an unsigned 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUIntBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUIntBE(0x13141516, 0, 4); - let ref = buf.readUIntBE(0, 3).toString(16); - expect(ref).assertEqual("131415"); - }); - - /** - * @tc.number : TEST_READ_U_INT_BE_002 - * @tc.name : testReadUIntBE002 - * @tc.desc : Reads an unsigned 8-bit integer from buf at the specified offset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUIntBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUIntBE(0x13141516, 0, 4); - try { - let ref = buf.readUIntBE(2, 3).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: 2'); - } - }); - - /** - * @tc.number : TEST_READ_U_INT_LE_001 - * @tc.name : testReadUIntLE001 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as an unsigned, little-endian integer supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUIntLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUIntLE(0x13141516, 0, 4); - let ref = buf.readUIntLE(0, 3).toString(16); - expect(ref).assertEqual("141516"); - }); - - /** - * @tc.number : TEST_READ_U_INT_LE_002 - * @tc.name : testReadUIntLE002 - * @tc.desc : Reads byteLength number of bytes from buf at the specified offset and interprets - * the result as an unsigned, little-endian integer supporting up to 48 bits of accuracy. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testReadUIntLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - buf.writeUIntLE(0x13141516, 0, 4); - try { - let ref = buf.readUIntLE(2, 3).toString(16); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: 2'); - } - }); - - /** - * @tc.number : TEST_SUBARRAY_001 - * @tc.name : testSubarray001 - * @tc.desc : Returns a new Buffer that references the same memory as the original, - * but offset and cropped by the start and end indices. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.subarray(0, 3); - */ - it("testSubarray001", 0, function () { - let buf1 = buffer.from("1236"); - let buf = buf1.subarray(0, 3); - let str = buf.toString(); - expect(str).assertEqual("123"); - }); - - /** - * @tc.number : TEST_SUBARRAY_002 - * @tc.name : testSubarray002 - * @tc.desc : Returns a new Buffer that references the same memory as the original, - * but offset and cropped by the start and end indices. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.subarray(3, 4); - */ - it("testSubarray002", 0, function () { - let buf1 = buffer.from("1236"); - let buf = buf1.subarray(3, 4); - let str = buf.toString(); - expect(str).assertEqual("6"); - }); - - /** - * @tc.number : TEST_SUBARRAY_003 - * @tc.name : testSubarray003 - * @tc.desc : Returns a new Buffer that references the same memory as the original, - * but offset and cropped by the start and end indices. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.subarray(-3, 0); - */ - it("testSubarray003", 0, function () { - let buf1 = buffer.from("1236"); - let buf = buf1.subarray(-3, 0); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_SUBARRAY_004 - * @tc.name : testSubarray004 - * @tc.desc : Returns a new Buffer that references the same memory as the original, - * but offset and cropped by the start and end indices. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.subarray(6, 9); - */ - it("testSubarray004", 0, function () { - let buf1 = buffer.from("1236"); - let buf = buf1.subarray(6, 9); - expect(buf.length).assertEqual(0); - }); - - /** - * @tc.number : TEST_SWAP_16_001 - * @tc.name : testSwap16001 - * @tc.desc : Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap16(); - */ - it("testSwap16001", 0, function () { - let buf1 = buffer.from("1323"); - buf1.swap16(); - let str = buf1.toString("hex"); - expect(str).assertEqual("33313332"); - }); - - /** - * @tc.number : TEST_SWAP_16_002 - * @tc.name : testSwap16002 - * @tc.desc : Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap16(); - */ - it("testSwap16002", 0, function () { - let buf1 = buffer.from("132"); - try { - buf1.swap16(); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual("Buffer size must be a multiple of 16-bits"); - } - }); - - /** - * @tc.number : TEST_SWAP_32_001 - * @tc.name : testSwap32001 - * @tc.desc : Interprets buf as an array of unsigned 32-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap32(); - */ - it("testSwap32001", 0, function () { - let buf1 = buffer.from("1234"); - buf1.swap32(); - let str = buf1.toString(); - expect(str).assertEqual("4321"); - }); - - /** - * @tc.number : TEST_SWAP_32_002 - * @tc.name : testSwap32002 - * @tc.desc : Interprets buf as an array of unsigned 16-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap32(); - */ - it("testSwap32002", 0, function () { - let buf1 = buffer.from("132"); - try { - buf1.swap32(); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual("Buffer size must be a multiple of 32-bits"); - } - }); - - /** - * @tc.number : TEST_SWAP_64_001 - * @tc.name : testSwap64001 - * @tc.desc : Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap64(); - */ - it("testSwap64001", 0, function () { - let buf1 = buffer.from("12345678"); - buf1.swap64(); - let str = buf1.toString(); - expect(str).assertEqual("87654321"); - }); - - /** - * @tc.number : TEST_SWAP_64_002 - * @tc.name : testSwap64002 - * @tc.desc : Interprets buf as an array of unsigned 64-bit integers and swaps the byte order in-place. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.swap64(); - */ - it("testSwap64002", 0, function () { - let buf1 = buffer.from("1234567"); - try { - buf1.swap64(); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual("Buffer size must be a multiple of 64-bits"); - } - }); - - /** - * @tc.number : TEST_TO_JSON_001 - * @tc.name : testToJSON001 - * @tc.desc : Returns a JSON representation of buf. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toJSON(); - */ - it("testToJSON001", 0, function () { - let buf1 = buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); - let obj = buf1.toJSON(); - expect(obj["data"].length == 5).assertTrue(); - }); - - /** - * @tc.number : TEST_TO_STRING_001 - * @tc.name : testToString001 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString(); - */ - it("testToString001", 0, function () { - let buf1 = buffer.from("1236"); - let str = buf1.toString(); - expect(str).assertEqual("1236"); - }); - - /** - * @tc.number : TEST_TO_STRING_002 - * @tc.name : testToString002 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString(); - */ - it("testToString002", 0, function () { - let buf1 = buffer.from("张三"); - let str = buf1.toString(); - expect(str).assertEqual("张三"); - }); - - /** - * @tc.number : TEST_TO_STRING_003 - * @tc.name : testToString003 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("binary"); - */ - it("testToString003", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("binary"); - expect(str).assertEqual("abc"); - }); - - /** - * @tc.number : TEST_TO_STRING_004 - * @tc.name : testToString004 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("binary"); - */ - it("testToString004", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("ascii"); - expect(str).assertEqual("abc"); - }); - - /** - * @tc.number : TEST_TO_STRING_005 - * @tc.name : testToString005 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("base64"); - */ - it("testToString005", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("base64"); - expect(str).assertEqual("YWJj"); - }); - - /** - * @tc.number : TEST_TO_STRING_006 - * @tc.name : testToString006 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("hex"); - */ - it("testToString006", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("hex"); - expect(str).assertEqual("616263"); - }); - - /** - * @tc.number : TEST_TO_STRING_007 - * @tc.name : testToString007 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("latin1"); - */ - it("testToString007", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("latin1"); - expect(str).assertEqual("abc"); - }); - - /** - * @tc.number : TEST_TO_STRING_008 - * @tc.name : testToString008 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("ucs2"); - */ - it("testToString008", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("ucs2"); - expect(str).assertEqual("扡"); - }); - - /** - * @tc.number : TEST_TO_STRING_009 - * @tc.name : testToString009 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString("utf16le"); - */ - it("testToString009", 0, function () { - let buf1 = buffer.from("abc"); - let str = buf1.toString("utf16le"); - expect(str).assertEqual("扡"); - }); - - /** - * @tc.number : TEST_TO_STRING_010 - * @tc.name : testToString010 - * @tc.desc : Decodes buf to a string according to the specified character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf1.toString(); - */ - it("testToString010", 0, function () { - let buf1 = buffer.from("!@#$%^&*"); - let str = buf1.toString(); - expect(str).assertEqual("!@#$%^&*"); - }); - - /** - * @tc.number : TEST_WRITE_001 - * @tc.name : testWrite001 - * @tc.desc : Writes string to buf at offset according to the character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf.write("abcde", "latin1"); - */ - it("testWrite001", 0, function () { - let buf = buffer.alloc(8); - try { - let offset = buf.write("abcde", -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 7. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_002 - * @tc.name : testWrite002 - * @tc.desc : Writes string to buf at offset according to the character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf.write("abcde", "latin1"); - */ - it("testWrite002", 0, function () { - let buf = buffer.alloc(8); - try { - let offset = buf.write("abcde", 1, 9); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "length" is out of range. It must be >= 0 and <= 8. Received value is: 9'); - } - }); - - /** - * @tc.number : TEST_WRITE_003 - * @tc.name : testWrite003 - * @tc.desc : Writes string to buf at offset according to the character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : buf.write("abcd", 0 ,4); - */ - it("testWrite003", 0, function () { - let buf = buffer.alloc(4); - buf.write("abcd", 0, 4); - const result = buf.toString(); - expect(result).assertEqual("abcd"); - }); - - /** - * @tc.number : TEST_WRITE_BIG_INT_64_BE_001 - * @tc.name : testWriteBigInt64BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigInt64BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeBigInt64BE(BigInt(0x0102030405060708), 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_BIG_INT_64_BE_002 - * @tc.name : testWriteBigInt64BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigInt64BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeBigInt64BE(BigInt(0x0102030405060708), 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_BIG_INT_64_LE_001 - * @tc.name : testWriteBigInt64LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigInt64LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeBigInt64LE(BigInt(0x0102030405060708), 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_BIG_INT_64_LE_002 - * @tc.name : testWriteBigInt64LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigInt64LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeBigInt64LE(BigInt(0x0102030405060708), 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_BIG_U_INT_64_BE_001 - * @tc.name : testWriteBigUInt64BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigUInt64BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeBigUInt64BE(BigInt(0x0102030405060708), 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_BIG_U_INT_64_BE_002 - * @tc.name : testWriteBigUInt64BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigUInt64BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeBigUInt64BE(BigInt(0x0102030405060708), 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_BIG_U_INT_64_LE_001 - * @tc.name : testWriteBigUInt64LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigUInt64LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeBigUInt64LE(BigInt(0x0102030405060708), 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_BIG_U_INT_64_LE_002 - * @tc.name : testWriteBigUInt64LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteBigUInt64LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeBigUInt64LE(BigInt(0x0102030405060708), 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_DOUBLE_BE_001 - * @tc.name : testWriteDoubleBE001 - * @tc.desc : Writes string to buf at offset according to the character encoding in encoding. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteDoubleBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeDoubleBE(123.456, 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_DOUBLE_BE_002 - * @tc.name : testWriteDoubleBE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteDoubleBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeDoubleBE(123.456, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_DOUBLE_LE_001 - * @tc.name : testWriteDoubleLE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteDoubleLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - let ref = buf.writeDoubleLE(123.456, 0); - expect(ref).assertEqual(8); - }); - - /** - * @tc.number : TEST_WRITE_DOUBLE_LE_002 - * @tc.name : testWriteDoubleLE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteDoubleLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(8); - try { - let ref = buf.writeDoubleLE(123.456, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_FLOAT_BE_001 - * @tc.name : testWriteFloatBE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteFloatBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeFloatBE(0xcabcbcbc, 0); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_FLOAT_BE_002 - * @tc.name : testWriteFloatBE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteFloatBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeFloatBE(0xcabcbcbc, 5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 5'); - } - }); - - /** - * @tc.number : TEST_WRITE_FLOAT_LE_001 - * @tc.name : testWriteFloatLE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteFloatLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(16); - let ref = buf.writeFloatLE(0xcabcbcbc, 12); - expect(ref).assertEqual(16); - }); - - /** - * @tc.number : TEST_WRITE_FLOAT_LE_002 - * @tc.name : testWriteFloatLE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteFloatLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeFloatLE(0xcabcbcbc, 5); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 5'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_8_001 - * @tc.name : testWriteInt8001 - * @tc.desc : Writes value to buf at the specified offset. - * value must be a valid signed 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt8001", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - let ref = buf.writeInt8(2, 0); - expect(ref).assertEqual(1); - }); - - /** - * @tc.number : TEST_WRITE_INT_8_002 - * @tc.name : testWriteInt8002 - * @tc.desc : Writes value to buf at the specified offset. - * value must be a valid signed 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt8002", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - try { - let ref = buf.writeInt8(2, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 1. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_8_003 - * @tc.name : testWriteInt8003 - * @tc.desc : Writes value to buf at the specified offset.value must be a valid signed 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt8003", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - try { - let ref = buf.writeInt8(0x13245, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= -128 and <= 127. Received value is: 78405'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_8_004 - * @tc.name : testWriteInt8004 - * @tc.desc : Writes value to buf at the specified offset.value must be a valid signed 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt8004", 0, function () { - let buf = buffer.allocUninitializedFromPool(2); - let ref = buf.writeInt8(0x2, 1); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_INT_16_BE_001 - * @tc.name : testWriteInt16BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 0); - */ - it("testWriteInt16BE001", 0, function () { - let buf = buffer.alloc(2); - let ref = buf.writeInt16BE(0x7bca, 0); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_INT_16_BE_002 - * @tc.name : testWriteInt16BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16BE002", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16BE(0x7bca, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_16_BE_003 - * @tc.name : testWriteInt16BE003 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16BE003", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16BE(0x123456, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= -32768 and <= 32767. Received value is: 1193046'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_16_BE_004 - * @tc.name : testWriteInt16BE004 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16BE004", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16BE(0x7bca, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_16_LE_001 - * @tc.name : testWriteInt16LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt16LE(0x1234, 0); - */ - it("testWriteInt16LE001", 0, function () { - let buf = buffer.alloc(2); - let ref = buf.writeInt16LE(0x1234, 0); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_INT_16_LE_002 - * @tc.name : testWriteInt16LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16LE002", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16LE(0x7bca, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_16_LE_003 - * @tc.name : testWriteInt16LE003 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16LE003", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16LE(0x123456, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= -32768 and <= 32767. Received value is: 1193046'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_16_LE_004 - * @tc.name : testWriteInt16LE004 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt16LE004", 0, function () { - let buf = buffer.alloc(2); - try { - let ref = buf.writeInt16LE(0x1234, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_32_BE_001 - * @tc.name : testWriteInt32BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example: let ref = buf.writeInt32BE(0x12345678, 0); - */ - it("testWriteInt32BE001", 0, function () { - let buf = buffer.alloc(4); - let ref = buf.writeInt32BE(0x12345678, 0); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_INT_32_BE_002 - * @tc.name : testWriteInt32BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt32BE002", 0, function () { - let buf = buffer.alloc(4); - try { - let ref = buf.writeInt32BE(0x12345678, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_32_BE_003 - * @tc.name : testWriteInt32BE003 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteInt32BE003", 0, function () { - let buf = buffer.alloc(4); - try { - let ref = buf.writeInt32BE(0x123456789, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received value is: 4886718345'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_32_LE_001 - * @tc.name : testWriteInt32LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 0); - */ - it("testWriteInt32LE001", 0, function () { - let buf = buffer.alloc(4); - let ref = buf.writeInt32LE(0x12345678, 0); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_INT_32_LE_002 - * @tc.name : testWriteInt32LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, -1); - */ - it("testWriteInt32LE002", 0, function () { - let buf = buffer.alloc(4); - try { - let ref = buf.writeInt32LE(0x12345678, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_32_LE_003 - * @tc.name : testWriteInt32LE003 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 0); - */ - it("testWriteInt32LE003", 0, function () { - let buf = buffer.alloc(4); - try { - let ref = buf.writeInt32LE(0x123456789, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= -2147483648 and <= 2147483647. Received value is: 4886718345'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_32_LE_004 - * @tc.name : testWriteInt32LE004 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid signed 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 1); - */ - it("testWriteInt32LE004", 0, function () { - let buf = buffer.alloc(4); - try { - let ref = buf.writeInt32LE(0x12345678, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_BE_001 - * @tc.name : testWriteIntBE001 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 1); - */ - it("testWriteIntBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - let ref = buf.writeIntBE(0x1234567890ab, 0, 6); - expect(ref).assertEqual(6); - }); - - /** - * @tc.number : TEST_WRITE_INT_BE_002 - * @tc.name : testWriteIntBE002 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 1); - */ - it("testWriteIntBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - try { - let ref = buf.writeIntBE(0x1234567890ab, 1, 6); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_INT_LE_001 - * @tc.name : testWriteIntLE001 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeInt32LE(0x12345678, 1); - */ - it("testWriteIntLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - let ref = buf.writeIntLE(0x1234567890ab, 0, 6); - expect(ref).assertEqual(6); - }); - - /** - * @tc.number : TEST_WRITE_INT_LE_002 - * @tc.name : testWriteIntLE002 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeIntLE(0x1234567890ab, 1, 6); - */ - it("testWriteIntLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(6); - try { - let ref = buf.writeIntLE(0x1234567890ab, 1, 6); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_8_001 - * @tc.name : testWriteUInt8001 - * @tc.desc : Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt8(0x42, 3); - */ - it("testWriteUInt8001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt8(0x42, 3); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_8_002 - * @tc.name : testWriteUInt8002 - * @tc.desc : Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt8(0x42, -1); - */ - it("testWriteUInt8002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt8(0x42, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 3. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_8_003 - * @tc.name : testWriteUInt8003 - * @tc.desc : Writes value to buf at the specified offset. value must be a valid unsigned 8-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt8(0x42, 1); - */ - it("testWriteUInt8003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt8(0x42, 1); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_BE_001 - * @tc.name : testWriteUInt16BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt8(0x42, 1); - */ - it("testWriteUInt16BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt16BE(0xdead, 0); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_BE_002 - * @tc.name : testWriteUInt16BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt16BE(0xdeadfc, 0); - */ - it("testWriteUInt16BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt16BE(0xdeadfc, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= 0 and <= 65535. Received value is: 14593532'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_BE_003 - * @tc.name : testWriteUInt16BE003 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt16BE(0xdeadfc, 0); - */ - it("testWriteUInt16BE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt16BE(0xdead, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 2. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_BE_004 - * @tc.name : testWriteUInt16BE004 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt16LE(0xdead, 1); - */ - it("testWriteUInt16BE004", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt16BE(0xdead, 1); - expect(ref).assertEqual(3); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_LE_001 - * @tc.name : testWriteUInt16LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt16LE(0xdead, 0); - */ - it("testWriteUInt16LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt16LE(0xdead, 0); - expect(ref).assertEqual(2); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_LE_002 - * @tc.name : testWriteUInt16LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUInt16LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt16LE(0xdeadfc, 0); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= 0 and <= 65535. Received value is: 14593532'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_LE_003 - * @tc.name : testWriteUInt16LE003 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUInt16LE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt16LE(0xdead, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 2. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_16_LE_004 - * @tc.name : testWriteUInt16LE004 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 16-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt16LE(0xdead, 0); - */ - it("testWriteUInt16LE004", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt16LE(0xdead, 1); - expect(ref).assertEqual(3); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_BE_001 - * @tc.name : testWriteUInt32BE001 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32BE(0xfeedface, 0); - */ - it("testWriteUInt32BE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt32BE(0xfeedface, 0); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_BE_002 - * @tc.name : testWriteUInt32BE002 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32BE(0xfeedface, -1); - */ - it("testWriteUInt32BE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt32BE(0xfeedface, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_BE_003 - * @tc.name : testWriteUInt32BE003 - * @tc.desc : Writes value to buf at the specified offset as big-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32BE(0xfeedface, 1); - */ - it("testWriteUInt32BE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt32BE(0xfeedface, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_LE_001 - * @tc.name : testWriteUInt32LE001 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32LE(0xfeedface, 0); - */ - it("testWriteUInt32LE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUInt32LE(0xfeedface, 0); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_LE_002 - * @tc.name : testWriteUInt32LE002 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32LE(0xfeedface, -1); - */ - it("testWriteUInt32LE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt32LE(0xfeedface, -1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: -1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_32_LE_003 - * @tc.name : testWriteUInt32LE003 - * @tc.desc : Writes value to buf at the specified offset as little-endian. - * The value must be a valid unsigned 32-bit integer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt32LE(0xfeedface, 1); - */ - it("testWriteUInt32LE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUInt32LE(0xfeedface, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_BE_001 - * @tc.name : testWriteUIntBE001 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUInt8(0x42, 3); - */ - it("testWriteUIntBE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUIntBE(0x13141516, 0, 4); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_BE_002 - * @tc.name : testWriteUIntBE002 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUIntBE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUIntBE(0x13141516, 0, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= 0 and <= 255. Received value is: 320083222'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_BE_003 - * @tc.name : testWriteUIntBE003 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as big-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUIntBE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUIntBE(0x13141516, 1, 4); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_LE_001 - * @tc.name : testWriteUIntLE001 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let ref = buf.writeUIntLE(0x13141516, 0, 4); - */ - it("testWriteUIntLE001", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - let ref = buf.writeUIntLE(0x13141516, 0, 4); - expect(ref).assertEqual(4); - }); - - /** - * @tc.number : TEST_WRITE_U_INT_LE_002 - * @tc.name : testWriteUIntLE002 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUIntLE002", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUIntLE(0x13141516, 0, 1); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "value" is out of range. It must be >= 0 and <= 255. Received value is: 320083222'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_LE_003 - * @tc.name : testWriteUIntLE003 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUIntLE003", 0, function () { - let buf = buffer.allocUninitializedFromPool(4); - try { - let ref = buf.writeUIntLE(0x13141516, 1, 4); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.message).assertEqual('The value of "offset" is out of range. It must be >= 0 and <= 0. Received value is: 1'); - } - }); - - /** - * @tc.number : TEST_WRITE_U_INT_LE_004 - * @tc.name : testWriteUIntLE004 - * @tc.desc : Writes byteLength bytes of value to buf at the specified offset as little-endian. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - */ - it("testWriteUIntLE004", 0, function () { - let buf = buffer.allocUninitializedFromPool(5); - let ref = buf.writeUIntLE(0x13141516, 1, 4); - expect(ref).assertEqual(5); - }); - - /** - * @tc.number : TEST_BLOB_CONSTRUCTOR_001 - * @tc.name : testBlobConstructor001 - * @tc.desc : Creates a new Blob object containing a concatenation of the given sources. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - */ - it("testBlobConstructor001", 0, async function () { - let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - let promise = blob2.text(); - promise.then((value) => { - expect(value).assertEqual("abc"); - }); - }); - - /** - * @tc.number : TEST_BLOB_CONSTRUCTOR_002 - * @tc.name : testBlobConstructor002 - * @tc.desc : Creates a new Blob object containing a concatenation of the given sources. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob([arrBuf], { type: "new type", endings: "transparent" }); - */ - it("testBlobConstructor002", 0, async function () { - let arrBuf = new ArrayBuffer(3); - let uint8arr = new Uint8Array(arrBuf); - uint8arr[0] = 97; - uint8arr[1] = 98; - uint8arr[2] = 99; - let blob2 = new buffer.Blob([arrBuf], { type: "new type", endings: "transparent" }); - blob2.text().then((value) => { - expect(value).assertEqual("abc"); - }); - }); - - /** - * @tc.number : TEST_BLOB_CONSTRUCTOR_003 - * @tc.name : testBlobConstructor003 - * @tc.desc : Creates a new Blob object containing a concatenation of the given sources. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob([uint8arr], { type: "new type", endings: "transparent" }) - */ - it("testBlobConstructor003", 0, async function () { - let uint8arr = new Uint8Array(3); - uint8arr[0] = 97; - uint8arr[1] = 98; - uint8arr[2] = 99; - let blob2 = new buffer.Blob([uint8arr], { type: "new type", endings: "transparent" }); - blob2.text().then((value) => { - expect(value).assertEqual("abc"); - }); - }); - - /** - * @tc.number : TEST_BLOB_CONSTRUCTOR_004 - * @tc.name : testBlobConstructor004 - * @tc.desc : Creates a new Blob object containing a concatenation of the given sources. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob([view], { type: "new type", endings: "transparent" }) - */ - it("testBlobConstructor004", 0, async function () { - let arrBuf = new ArrayBuffer(3); - let uint8arr = new Uint8Array(arrBuf); - uint8arr[0] = 97; - uint8arr[1] = 98; - uint8arr[2] = 99; - let view = new DataView(arrBuf); - let blob2 = new buffer.Blob([view], { type: "new type", endings: "transparent" }); - blob2.text().then((value) => { - expect(value).assertEqual("abc"); - }); - }); - - /** - * @tc.number : TEST_BLOB_CONSTRUCTOR_005 - * @tc.name : testBlobConstructor005 - * @tc.desc : Creates a new Blob object containing a concatenation of the given sources. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - * let blob = new buffer.Blob([blob2]); - */ - it("testBlobConstructor005", 0, async function () { - let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - let blob = new buffer.Blob([blob2]); - blob.text().then((value) => { - expect(value).assertEqual("abc"); - }); - }); - - /** - * @tc.number : TEST_BLOB_SIZE_001 - * @tc.name : testBlobSize001 - * @tc.desc : The total size of the Blob in bytes. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 0 - */ - it("testBlobSize001", 0, function () { - let blob = new buffer.Blob(["a", "b", "c"]); - let size = blob.size; - expect(size).assertEqual(3); - }); - - /** - * @tc.number : TEST_BLOB_TYPE_001 - * @tc.name : testBlobType001 - * @tc.desc : The content-type of the Blob. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 0 - */ - it("testBlobType001", 0, function () { - let blob = new buffer.Blob(["a", "b", "c"], { type: "mime", endings: "transparent" }); - let type = blob.type; - expect(type).assertEqual("mime"); - }); - - /** - * @tc.number : TEST_BLOB_ARRAY_BUFFER_001 - * @tc.name : testBlobArrayBuffer001 - * @tc.desc : Returns a promise that fulfills with an containing a copy of the Blob data. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - */ - it("testBlobArrayBuffer001", 0, async function () { - let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - blob2.arrayBuffer().then((value) => { - let arr = new Uint8Array(value); - for (let i = 0, len = arr.length; i < len; i++) { - expect(arr[i]).assertEqual(97 + i); - } - }); - }); - - /** - * @tc.number : TEST_BLOB_Slice_001 - * @tc.name : testBlobSlice001 - * @tc.desc : Creates and returns a new Blob containing a subset of this Blob objects data. - * The original Blob is not altered. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - * let blob = blob2.slice(0, 1); - */ - it("testBlobSlice001", 0, async function () { - let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - let blob = blob2.slice(0, 1); - blob.arrayBuffer().then((value) => { - let arr = new Uint8Array(value); - expect(arr[0]).assertEqual(97); - expect(arr[1]).assertEqual(98); - expect(arr[2]).assertEqual(99); - }); - }); - - /** - * @tc.number : TEST_BLOB_TEXT_001 - * @tc.name : testBlobText001 - * @tc.desc : Returns a promise that fulfills with the contents of the Blob decoded as a UTF-8 string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : level 2 - * For example : let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - */ - it("testBlobText001", 0, async function () { - let blob2 = new buffer.Blob(["a", "b", "c"], { type: "new type", endings: "transparent" }); - blob2.text().then((value) => { - expect(value).assertEqual("abc"); - }); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 0250ae0209cda029cab6415590e049720c2088cc..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import BufferTest from './Buffer.test' - -export default function testsuite() { - BufferTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarybufferetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/app.json deleted file mode 100644 index 6f58491ddf9cf37996ed945d57fa0afa03cb7b4e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.convertxml.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/BUILD.gn deleted file mode 100644 index b067b76ea2d66538e55ec0a0c050319437979169..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformConvertxmlTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformConvertxmlTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/Test.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/Test.json deleted file mode 100644 index adb1ba84adddcaf1717fc7626d7a125f116f0bd7..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.convertxml.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformConvertxmlTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/signature/openharmony_sx.p7b deleted file mode 100644 index 8010658c7b88ccff37fc93c9b64ef835aa4f168a..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 6b5ba642bc80375ad08753f3745b1fa46d7a90a8..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import XmlTest from './convertxml.test' - -export default function testsuite() { - XmlTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/convertxml.test.ets b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/convertxml.test.ets deleted file mode 100644 index 943af1b5b9ee06ba68e883fe22ad628dfaad4e1b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/ets/test/convertxml.test.ets +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -import convertxml from "@ohos.convertxml"; -export default function XmlTest() { - describe("XmlTest", function () { - /** - * @tc.number: TEST_CONVERT_XML_001 - * @tc.name : testConvertXml001 - * @tc.desc : To convert XML text to JavaScript object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertXml001", 0, function () { - let xml = "\n"; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - console.info(result["_elements"][0]["_name"]); - expect(result["_elements"][0]["_name"] == "a").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_XML_002 - * @tc.name : testConvertXml002 - * @tc.desc : To convert XML text to JavaScript object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertXml002", 0, function () { - let xml = '' + '' + "Happy" + ""; - let conv = new convertxml.ConvertXML(); - let options = { - trim: false, - declarationKey: "_declaration", - ignoreComment: true, - instructionKey: "_instruction", - attributesKey: "_attributes", - textKey: "_text", - cdataKey: "_cdata", - doctypeKey: "_doctype", - commentKey: "_comment", - parentKey: "_parent", - typeKey: "_type", - nameKey: "_name", - elementsKey: "_elements", - }; - let result = conv.convertToJSObject(xml, options); - console.info("================testConvert001================="); - console.info(result["_elements"][0]["_elements"][0]["_text"]); - console.info(result["_elements"][0]); - console.info(result["_elements"][0]["_name"]); - expect(result["_elements"][0]["_elements"][0]["_text"] == "Happy").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_XML_003 - * @tc.name : testConvertXml003 - * @tc.desc : To convert XML text to JavaScript object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertXml003", 0, function () { - let xml = "Hi"; - let conv = new convertxml.ConvertXML(); - let options = { trim: true, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - console.info("================testConvert002================="); - console.info(result["_elements"][0]["_elements"][0]["_text"]); - expect(result["_elements"][0]["_elements"][0]["_text"] == "Hi").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_XML_004 - * @tc.name : testConvertXml004 - * @tc.desc : To convert XML text to JavaScript object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertXml004", 0, function () { - let xml = ""; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - console.info("================testConvert003================="); - console.info(result["_elements"][0]["_instruction"]); - expect(result["_elements"][0]["_instruction"] == "there").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_XML_005 - * @tc.name : testConvertXml005 - * @tc.desc : To convert XML text to JavaScript object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConvertXml005", 0, function () { - let xml = ""; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - console.info("================testConvert004================="); - console.info(result["_elements"][0]["_type"]); - expect(result["_elements"][0]["_type"] == "instruction").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_OPTIONS_001 - * @tc.name : testConvertOptions001 - * @tc.desc : To test ConvertOptions. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testConvertOptions001", 0, function () { - let xml = '' + '' + " Happy" + " Work" + " Play" + ""; - let conv = new convertxml.ConvertXML(); - let options = { - trim: false, - ignoreDeclaration: false, - ignoreInstruction: false, - ignoreAttributes: false, - ignoreComment: false, - ignoreCDATA: false, - ignoreDoctype: false, - ignoreText: false, - declarationKey: "_declaration", - instructionKey: "_instruction", - attributesKey: "_attributes", - textKey: "_text", - cdataKey: "_cdata", - doctypeKey: "_doctype", - commentKey: "_comment", - parentKey: "_parent", - typeKey: "_type", - nameKey: "_name", - elementsKey: "_elements", - }; - let result = conv.convertToJSObject(xml, options); - expect(result["_declaration"] != null).assertTrue(); - expect(result["_parent"] == null).assertTrue(); - expect(result["_elements"][0]["_type"] == "element").assertTrue(); - expect(result["_elements"][0]["_name"] == "note").assertTrue(); - expect(result["_elements"][0]["_elements"] != null).assertTrue(); - expect(result["_declaration"]["_attributes"]["version"] == "1.0").assertEqual(true); - }); - - /** - * @tc.number: TEST_CONVERT_OPTIONS_002 - * @tc.name : testConvertOptions002 - * @tc.desc : To test ConvertOptions. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testConvertOptions002", 0, function () { - let xml = '' + "" + '' + " Happy" + " Work" + " Play" + ""; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - expect(result["_elements"][0]["doctype"] == "foo").assertTrue(); - }); - - /** - * @tc.number: TEST_CONVERT_OPTIONS_003 - * @tc.name : testConvertOptions003 - * @tc.desc : To test ConvertOptions. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testConvertOptions003", 0, function () { - let xml = ' " and & \t ]]>'; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - expect(result["_elements"][0]["_cdata"] != null).assertTrue(); - }); - - /** - * @tc.number: TEST_CONVERT_OPTIONS_004 - * @tc.name : testConvertOptions004 - * @tc.desc : To test ConvertOptions. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testConvertOptions004", 0, function () { - let xml = "\n"; - let conv = new convertxml.ConvertXML(); - let options = { trim: false, declarationKey: "_declaration", instructionKey: "_instruction", attributesKey: "_attributes", textKey: "_text", cdataKey: "_cdata", doctypeKey: "_doctype", commentKey: "_comment", parentKey: "_parent", typeKey: "_type", nameKey: "_name", elementsKey: "_elements" }; - let result = conv.convertToJSObject(xml, options); - expect(result["_elements"][0]["_comment"] != null).assertTrue(); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryconvertxmletstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/app.json deleted file mode 100644 index adb4accca5f39a9f9c2e35228615a95266f5c87e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.deque.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarydequeetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibrarydequeetstest/BUILD.gn deleted file mode 100644 index 900f27ebcde343d204f778a1ae66b5425a4253e4..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformDequeTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformDequeTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/Test.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/Test.json deleted file mode 100644 index a417beae00cd2f74c2ba3c41a41f31f23da2563e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.deque.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformDequeTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibrarydequeetstest/signature/openharmony_sx.p7b deleted file mode 100644 index 03b0ff00d2038584ac3351ec4fee3acb9328e187..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarydequeetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/Deque.test.ets b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/Deque.test.ets deleted file mode 100644 index a422341759c5ae56b9267183e49afdab3addf27e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/Deque.test.ets +++ /dev/null @@ -1,596 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import Deque from "@ohos.util.Deque"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -export default function DequeTest() { - describe("DequeTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an Deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let deque = new Deque(); - expect(deque != null).assertTrue(); - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of elements in the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 0 - */ - it("testLength001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertEnd(9); - let size = deque.length; - expect(size).assertEqual(2); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_001 - * @tc.name : testInsertFront001 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront001", 0, function () { - let deque = new Deque(); - deque.insertFront("一"); - let res = deque.getFirst(); - expect(res).assertEqual("一"); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_002 - * @tc.name : testInsertFront002 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront002", 0, function () { - let deque = new Deque(); - deque.insertFront(8); - let res = deque.getFirst(); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_003 - * @tc.name : testInsertFront003 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront003", 0, function () { - let deque = new Deque(); - let a = { name: "lala", age: "15" }; - deque.insertFront(a); - let res = deque.getFirst(); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_004 - * @tc.name : testInsertFront004 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront004", 0, function () { - let deque = new Deque(); - deque.insertFront("$"); - let res = deque.getFirst(); - expect(res).assertEqual("$"); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_005 - * @tc.name : testInsertFront005 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront005", 0, function () { - let deque = new Deque(); - deque.insertFront(" "); - let res = deque.getFirst(); - expect(res).assertEqual(" "); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_006 - * @tc.name : testInsertFront006 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront006", 0, function () { - let deque = new Deque(); - deque.insertFront(null); - let res = deque.getFirst(); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_007 - * @tc.name : testInsertFront007 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront007", 0, function () { - let deque = new Deque(); - deque.insertFront(undefined); - let res = deque.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_008 - * @tc.name : testInsertFront008 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront008", 0, function () { - let deque = new Deque(); - for (let i = 0; i < 100; i++) { - deque.insertFront(i); - let res = deque.getFirst(); - expect(res).assertEqual(i); - } - let res1 = deque.length; - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_009 - * @tc.name : testInsertFront009 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront009", 0, function () { - let deque = new Deque(); - let a = [1, 2, 3, 4]; - deque.insertFront(a); - let res = deque.getFirst(); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_INSERT_FRONT_010 - * @tc.name : testInsertFront010 - * @tc.desc : Add element to deque instance header. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertFront010", 0, function () { - let deque = new Deque(); - try { - deque.insertFront.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The insertFront method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_INSERT_END_001 - * @tc.name : testInsertEnd001 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - let res = deque.getLast(); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_INSERT_END_002 - * @tc.name : testInsertEnd002 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd002", 0, function () { - let deque = new Deque(); - let a = ["a", "b", "c"]; - deque.insertEnd(a); - let res = deque.getLast(); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_INSERT_END_003 - * @tc.name : testInsertEnd003 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd003", 0, function () { - let deque = new Deque(); - let a = { class: "6班", say: "we" }; - deque.insertEnd(a); - let res = deque.getLast(); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_INSERT_END_004 - * @tc.name : testInsertEnd004 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd004", 0, function () { - let deque = new Deque(); - deque.insertEnd("$"); - let res = deque.getLast(); - expect(res).assertEqual("$"); - }); - - /** - * @tc.number: TEST_INSERT_END_005 - * @tc.name : testInsertEnd005 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd005", 0, function () { - let deque = new Deque(); - deque.insertEnd(" "); - let res = deque.getLast(); - expect(res).assertEqual(" "); - }); - - /** - * @tc.number: TEST_INSERT_END_006 - * @tc.name : testInsertEnd006 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd006", 0, function () { - let deque = new Deque(); - deque.insertEnd(null); - let res = deque.getLast(); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_INSERT_END_007 - * @tc.name : testInsertEnd007 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd007", 0, function () { - let deque = new Deque(); - deque.insertEnd(undefined); - let res = deque.getLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_INSERT_END_008 - * @tc.name : testInsertEnd008 - * @tc.desc : Add element to deque instance end. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testInsertEnd008", 0, function () { - let deque = new Deque(); - for (let i = 0; i < 100; i++) { - deque.insertEnd(i); - let res = deque.getLast(); - expect(res).assertEqual(i); - } - let res1 = deque.length; - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Determine whether the deque instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let deque = new Deque(); - deque.insertEnd(6); - let res = deque.has(6); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_002 - * @tc.name : testHas002 - * @tc.desc : Determine whether the deque instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas002", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - let res = deque.has(6); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_003 - * @tc.name : testHas003 - * @tc.desc : Determine whether the deque instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas003", 0, function () { - let deque = new Deque(); - let res = deque.has(6); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_GET_FIRST_001 - * @tc.name : testGetFirst001 - * @tc.desc : Get the header element of the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirst001", 0, function () { - let deque = new Deque(); - deque.insertEnd("四"); - deque.insertEnd("三"); - let res = deque.getFirst(); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number: TEST_GET_FIRST_002 - * @tc.name : testGetFirst002 - * @tc.desc : Get the header element of the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirst002", 0, function () { - let deque = new Deque(); - let res = deque.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_LAST_001 - * @tc.name : testGetLast001 - * @tc.desc : Get the end element of the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLast001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertEnd("三"); - let res = deque.getLast(); - expect(res).assertEqual("三"); - }); - - /** - * @tc.number: TEST_GET_LAST_002 - * @tc.name : testGetLast002 - * @tc.desc : Get the end element of the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLast002", 0, function () { - let deque = new Deque(); - let res = deque.getLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_POP_FIRST_001 - * @tc.name : testPopFirst001 - * @tc.desc : Delete the header element of a deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopFirst001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertFront("一"); - let res = deque.popFirst(); - expect(res).assertEqual("一"); - }); - - /** - * @tc.number: TEST_POP_FIRST_002 - * @tc.name : testPopFirst002 - * @tc.desc : Delete the header element of a deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopFirst002", 0, function () { - let deque = new Deque(); - let res = deque.popFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_POP_LAST_001 - * @tc.name : testPopLast001 - * @tc.desc : Delete the end element of a deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopLast001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertFront("一"); - deque.insertFront("二"); - let res = deque.popLast(); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_POP_LAST_002 - * @tc.name : testPopLast002 - * @tc.desc : Delete the end element of a deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopLast002", 0, function () { - let deque = new Deque(); - let res = deque.popLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traversing elements in deque instances. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertFront("一"); - deque.insertFront("二"); - deque.insertEnd(1); - deque.insertEnd(2); - deque.insertEnd(3); - deque.insertEnd(4); - deque.insertEnd(5); - deque.insertEnd(6); - deque.insertFront("三"); - deque.insertFront("四"); - let arr = []; - deque.forEach((item, index) => { - arr.push(item); - }); - let a = ["四", "三", "二", "一", 8, 1, 2, 3, 4, 5, 6]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traversing elements in deque instances. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach002", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertEnd(1); - deque.insertEnd(2); - deque.insertEnd(3); - deque.insertEnd(3); - deque.insertEnd(4); - deque.insertEnd(5); - deque.insertEnd(6); - deque.popFirst(); - deque.popLast(); - deque.insertFront(8); - deque.insertEnd(6); - let arr = []; - deque.forEach((item, index) => { - arr.push(item); - }); - let a = [8, 1, 2, 3, 3, 4, 5, 6]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all elements in the deque instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let deque = new Deque(); - deque.insertEnd(8); - deque.insertFront("a"); - deque.insertFront("b"); - deque.insertEnd(5); - deque.insertEnd(6); - deque.insertFront("s"); - deque.insertFront("z"); - deque.popFirst(); - deque.popLast(); - deque.insertFront("g"); - deque.insertEnd(6); - let size = deque.length; - let arr = []; - let itr = deque[Symbol.iterator](); - for (let i = 0; i < size; i++) { - arr.push(itr.next().value); - } - let a = ["g", "s", "b", "a", 8, 5, 6]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index f76f2efdc161a479c89903232d86e4ed879ff05f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import DequeTest from './Deque.test' - -export default function testsuite() { - DequeTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarydequeetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/app.json deleted file mode 100644 index da0623af2a2346b6504631eeb1311cb87a6c27e7..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.hashmap.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashmapetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryhashmapetstest/BUILD.gn deleted file mode 100644 index abcfb05675cb417098e917cb255e85dc217fade0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformHashMapTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformHashMapTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/Test.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/Test.json deleted file mode 100644 index 57bd907f89d71747c15d5c8fbd221a12a176428f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.hashmap.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformHashMapTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryhashmapetstest/signature/openharmony_sx.p7b deleted file mode 100644 index 4aebea87e453498aa3a08822e56c7d1af73dcb0b..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashmapetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/HashMap.test.ets b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/HashMap.test.ets deleted file mode 100644 index 7d2dfc60c34fb15147940fecb7fa35d31399271c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/HashMap.test.ets +++ /dev/null @@ -1,973 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import HashMap from "@ohos.util.HashMap"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -export default function HashMapTest() { - describe("HashMapTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an HashMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let hashMap = new HashMap(); - expect(hashMap != undefined).assertEqual(true); - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of key value pairs in the HashMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 0 - */ - it("testLength001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the HashMap instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.length; - let res1 = hashMap.isEmpty(); - expect(res).assertEqual(5); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the HashMap instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - hashMap.clear(); - let res = hashMap.length; - let res1 = hashMap.isEmpty(); - expect(res).assertEqual(0); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_EMPTY_003 - * @tc.name : testIsEmpty003 - * @tc.desc : Determine whether the HashMap instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty003", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.isEmpty.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The isEmpty method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_HAS_KEY_001 - * @tc.name : testHasKey001 - * @tc.desc : Determine whether the HashMap contains the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasKey001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.hasKey(3); - expect(res).assertEqual(true); - let res1 = hashMap.hasKey(8); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_KEY_002 - * @tc.name : testHasKey002 - * @tc.desc : Determine whether the HashMap contains the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasKey002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.hasKey(8); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_KEY_003 - * @tc.name : testHasKey003 - * @tc.desc : Determine whether the HashMap contains the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testKeys003", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.keys(); - for (let i = 0; i < hashMap.length; i++) { - let result = hashMap.hasKey(res.next().value); - expect(result).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_HAS_KEY_004 - * @tc.name : testHasKey004 - * @tc.desc : Determine whether the HashMap contains the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasKey004", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.hasKey.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The hasKey method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_HAS_VALUE_001 - * @tc.name : testHasValue001 - * @tc.desc : Determine whether the HashMap contains the specified value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasValue001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.hasValue("C"); - expect(res).assertEqual(true); - let res1 = hashMap.hasValue(8); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_VALUE_002 - * @tc.name : testHasValue002 - * @tc.desc : Determine whether the HashMap contains the specified value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasValue002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.hasValue(8); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_VALUE_003 - * @tc.name : testHasValue003 - * @tc.desc : Determine whether the HashMap contains the specified value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHasValue003", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.values(); - for (let i = 0; i < hashMap.length; i++) { - let has = hashMap.hasValue(res.next().value); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_GET_001 - * @tc.name : testGet001 - * @tc.desc : Get the corresponding value through the key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.get(3); - expect(res).assertEqual("C"); - }); - - /** - * @tc.number: TEST_GET_002 - * @tc.name : testGet002 - * @tc.desc : Get the corresponding value through the key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.get(3); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_003 - * @tc.name : testGet003 - * @tc.desc : Get the corresponding value through the key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet003", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.get.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The get method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_SET_ALL_001 - * @tc.name : testSetAll001 - * @tc.desc : Copy key value pairs from one HashMap to another. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAll001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let hashMap1 = new HashMap(); - hashMap1.set(1, 1); - hashMap1.set(2, 2); - hashMap.setAll(hashMap1); - let arr = []; - for (let [key, value] of hashMap) { - arr.push([key, value]); - } - arr.sort(function (a, b) { - return a[0] - b[0]; - }); - - for (let i = 0; i < arr.length; i++) { - expect(arr[i][0]).assertEqual(i + 1); - expect(arr[i][1]).assertEqual(hashMap.get(i + 1)); - } - }); - - /** - * @tc.number: TEST_SET_ALL_002 - * @tc.name : testSetAll002 - * @tc.desc : Copy key value pairs from one HashMap to another. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAll002", 0, function () { - let hashMap = new HashMap(); - let hashMap1 = new HashMap(); - hashMap1.set(1, 1); - hashMap1.set(2, 2); - hashMap.setAll(hashMap1); - let arr = []; - for (let [key, value] of hashMap) { - arr.push([key, value]); - } - arr.sort(function (a, b) { - return a[0] - b[0]; - }); - for (let i = 0; i < arr.length; i++) { - expect(JSON.stringify(arr[i])).assertEqual(JSON.stringify([i + 1, hashMap.get(i + 1)])); - } - }); - - /** - * @tc.number: TEST_SET_001 - * @tc.name : testSet001 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - let res = hashMap.get(1); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_002 - * @tc.name : testSet002 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet002", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, 2); - let res = hashMap.get(1); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_SET_003 - * @tc.name : testSet003 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet003", 0, function () { - let hashMap = new HashMap(); - let c = [1, 2, 3]; - hashMap.set(1, c); - let res = hashMap.get(1); - expect(res).assertEqual(c); - }); - - /** - * @tc.number: TEST_SET_004 - * @tc.name : testSet004 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet004", 0, function () { - let hashMap = new HashMap(); - let c = { name: "lili", age: "13" }; - hashMap.set(1, c); - let res = hashMap.get(1); - expect(res).assertEqual(c); - }); - - /** - * @tc.number: TEST_SET_005 - * @tc.name : testSet005 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet005", 0, function () { - let hashMap = new HashMap(); - hashMap.set("a", "A"); - let res = hashMap.get("a"); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_006 - * @tc.name : testSet006 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet006", 0, function () { - let hashMap = new HashMap(); - hashMap.set("", "A"); - let res = hashMap.get(""); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_007 - * @tc.name : testSet007 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet007", 0, function () { - let hashMap = new HashMap(); - hashMap.set("$", "A"); - let res = hashMap.get("$"); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_008 - * @tc.name : testSet008 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet008", 0, function () { - let hashMap = new HashMap(); - hashMap.set(3.14, "A"); - let res = hashMap.get(3.14); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_009 - * @tc.name : testSet009 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet009", 0, function () { - let hashMap = new HashMap(); - hashMap.set(0.3, "A"); - let res = hashMap.get(0.3); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_0010 - * @tc.name : testSet010 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet010", 0, function () { - let hashMap = new HashMap(); - hashMap.set(-1, "A"); - let res = hashMap.get(-1); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_011 - * @tc.name : testSet011 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet011", 0, function () { - let hashMap = new HashMap(); - let a = {}; - hashMap.set(a, "A"); - let res = hashMap.get(a); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_SET_012 - * @tc.name : testSet012 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet012", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, null); - let res = hashMap.get(1); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_SET_013 - * @tc.name : testSet013 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet013", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "$"); - let res = hashMap.get(1); - expect(res).assertEqual("$"); - }); - - /** - * @tc.number: TEST_SET_014 - * @tc.name : testSet014 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet014", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, 3.14); - let res = hashMap.get(1); - expect(res).assertEqual(3.14); - }); - - /** - * @tc.number: TEST_SET_015 - * @tc.name : testSet015 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet015", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, -1); - let res = hashMap.get(1); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_SET_016 - * @tc.name : testSet016 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet016", 0, function () { - let hashMap = new HashMap(); - let a = {}; - hashMap.set(1, a); - let res = hashMap.get(1); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_SET_017 - * @tc.name : testSet017 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet017", 0, function () { - let hashMap = new HashMap(); - for (let i = 0; i < 100; i++) { - hashMap.set(1, i); - } - let res = hashMap.get(1); - let res1 = hashMap.length; - expect(res).assertEqual(99); - expect(res1).assertEqual(1); - }); - - /** - * @tc.number: TEST_SET_018 - * @tc.name : testSet018 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet018", 0, function () { - let hashMap = new HashMap(); - for (let i = 0; i < 100; i++) { - hashMap.set(i, 1); - let res = hashMap.get(i); - expect(res).assertEqual(1); - } - let res1 = hashMap.length; - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_SET_019 - * @tc.name : testSet019 - * @tc.desc : Add a pair of key value pairs to the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSet019", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.set.bind({}, 1, "A")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The set method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete key value pairs according to key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.remove(3); - expect(res).assertEqual("C"); - let res1 = hashMap.length; - expect(res1).assertEqual(4); - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete key value pairs according to key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.remove(3); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_003 - * @tc.name : testRemove003 - * @tc.desc : Delete key value pairs according to key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove003", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.remove.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The remove method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all key value pairs in HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.length; - expect(res).assertEqual(5); - hashMap.clear(); - let res1 = hashMap.length; - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all key value pairs in HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let hashMap = new HashMap(); - hashMap.clear(); - let res = hashMap.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_KEYS_001 - * @tc.name : testKeys001 - * @tc.desc : Get a collection of all the keys in the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testKeys001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.keys(); - for (let i = 0; i < hashMap.length; i++) { - let result = hashMap.hasKey(res.next().value); - expect(result).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Get a collection of all the values in the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testValues001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.values(); - for (let i = 0; i < hashMap.length; i++) { - let has = hashMap.hasValue(res.next().value); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_REPLACE_001 - * @tc.name : testReplace001 - * @tc.desc : Modify the corresponding value according to the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplace001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.replace(2, "G"); - expect(res).assertEqual(true); - expect(hashMap.get(2)).assertEqual("G"); - }); - - /** - * @tc.number: TEST_REPLACE_002 - * @tc.name : testReplace002 - * @tc.desc : Modify the corresponding value according to the specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testReplace002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.replace(2, "G"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse all key value pairs in the HashMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let vals = []; - let keys = []; - hashMap.forEach((value, key) => { - keys.push(key); - vals.push(value); - }); - for (let i = 0; i < keys.length; i++) { - let has = hashMap.hasKey(keys[i]); - expect(has).assertEqual(true); - } - for (let i = 0; i < vals.length; i++) { - let has = hashMap.hasValue(vals[i]); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traverse all key value pairs in the HashMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach002", 0, function () { - let hashMap = new HashMap(); - let arr = []; - hashMap.forEach((item, index) => { - arr.push(item); - }); - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.number: TEST_FOR_EACH_003 - * @tc.name : testForEach003 - * @tc.desc : Traverse all key value pairs in the HashMap instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach003", 0, function () { - let hashMap = new HashMap(); - try { - hashMap.forEach.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The forEach method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Get all key value pairs collection in HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let res = hashMap.entries(); - let arr = []; - for (let i = 0; i < hashMap.length; i++) { - let obj = res.next(); - arr.push([obj.value[0], obj.value[1]]); - } - arr.sort(function (a, b) { - return a[0] - b[0]; - }); - for (let i = 0; i < arr.length; i++) { - expect(arr[i][0]).assertEqual(i + 1); - expect(arr[i][1]).assertEqual(hashMap.get(i + 1)); - } - }); - - /** - * @tc.number: TEST_ENTRIES_002 - * @tc.name : testEntries002 - * @tc.desc : Get all key value pairs collection in HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries002", 0, function () { - let hashMap = new HashMap(); - let res = hashMap.entries(); - expect(undefined).assertEqual(res.next().value); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all key value pairs in the HashMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let hashMap = new HashMap(); - hashMap.set(1, "A"); - hashMap.set(2, "B"); - hashMap.set(3, "C"); - hashMap.set(4, "D"); - hashMap.set(5, "E"); - let arr = []; - let iters = hashMap[Symbol.iterator](); - let flag = true; - for (let i = 0, len = hashMap.length; i < len; i++) { - let entry = iters.next().value; - let res = hashMap.get(entry[0]); - if (res != entry[1]) { - flag = false; - break; - } - } - expect(flag).assertEqual(true); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 88e9cef4295a2deae89e28164996c50c204d1452..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import HashMapTest from './HashMap.test' - -export default function testsuite() { - HashMapTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashmapetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/app.json deleted file mode 100644 index 099ff802bb1341113aa9abb8d73baa059b134a25..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.hashset.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashsetetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryhashsetetstest/BUILD.gn deleted file mode 100644 index 56f5f71fb00aa0fc194c52699a58e256732c390b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformHashSetTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformHashSetTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/Test.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/Test.json deleted file mode 100644 index 7f14d218d42157a4cee452c182ef144d590770fd..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.hashset.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformHashSetTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryhashsetetstest/signature/openharmony_sx.p7b deleted file mode 100644 index d04f3af89b60e5116cd9152623b8432afa511691..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashsetetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/HashSet.test.ets b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/HashSet.test.ets deleted file mode 100644 index d74f01147eca91519868021bfd6f292b026e51a1..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/HashSet.test.ets +++ /dev/null @@ -1,605 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import HashSet from "@ohos.util.HashSet"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -export default function HashSetTest() { - describe("HashSetTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let hashSet = new HashSet(); - expect(hashSet != null).assertTrue(); - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of element in the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 0 - */ - it("testLength001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(2); - let res = hashSet.length; - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the HashSet instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(4); - hashSet.add(1); - let res = hashSet.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the HashSet instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(2); - hashSet.clear(); - let res = hashSet.isEmpty(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_EMPTY_003 - * @tc.name : testIsEmpty003 - * @tc.desc : Determine whether the HashSet instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty003", 0, function () { - let hashSet = new HashSet(); - try { - hashSet.isEmpty.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The isEmpty method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Determine whether the HashSet instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(4); - hashSet.add(1); - hashSet.add(3); - hashSet.add(2); - hashSet.add(5); - let res = hashSet.has(1); - expect(res).assertEqual(true); - let res1 = hashSet.has("A"); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_002 - * @tc.name : testHas002 - * @tc.desc : Determine whether the HashSet instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas002", 0, function () { - let hashSet = new HashSet(); - let res = hashSet.has(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_HAS_003 - * @tc.name : testHas003 - * @tc.desc : Determine whether the HashSet instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas003", 0, function () { - let hashSet = new HashSet(); - try { - hashSet.has.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The has method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - let res = hashSet.has(1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let hashSet = new HashSet(); - hashSet.add("b"); - hashSet.add("a"); - hashSet.add("g"); - let res = hashSet.has("a"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let hashSet = new HashSet(); - let c = [1, 2, 3]; - hashSet.add(c); - let res = hashSet.has(c); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let hashSet = new HashSet(); - let c = { name: "lili", age: "13" }; - hashSet.add(c); - let res = hashSet.has(c); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let hashSet = new HashSet(); - hashSet.add(""); - let res = hashSet.has(""); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let hashSet = new HashSet(); - hashSet.add("$"); - let res = hashSet.has("$"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1.34); - let res = hashSet.has(1.34); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let hashSet = new HashSet(); - hashSet.add(-1); - let res = hashSet.has(-1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let hashSet = new HashSet(); - let a = {}; - hashSet.add(a); - let res = hashSet.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let hashSet = new HashSet(); - for (let i = 0; i < 100; i++) { - hashSet.add(i); - let res = hashSet.has(i); - expect(res).assertEqual(true); - } - let res1 = hashSet.length; - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_ADD_011 - * @tc.name : testAdd011 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd011", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(1); - let has = hashSet.has(1); - let size = hashSet.length; - expect(has).assertEqual(true); - expect(size).assertEqual(1); - }); - - /** - * @tc.number: TEST_ADD_012 - * @tc.name : testAdd012 - * @tc.desc : Add element to HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd012", 0, function () { - let hashSet = new HashSet(); - try { - hashSet.add.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(4); - hashSet.add(1); - hashSet.add(3); - hashSet.add(2); - hashSet.add(5); - let res = hashSet.remove(1); - expect(res).assertEqual(true); - let arr = []; - hashSet.forEach((value, index) => { - arr.push(value); - }); - for (let i = 0; i < arr.length; i++) { - let has = hashSet.has(arr[i]); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let hashSet = new HashSet(); - let res = hashSet.remove(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(4); - hashSet.add(1); - hashSet.add(3); - hashSet.add(2); - hashSet.add(5); - let res = hashSet.length; - expect(res).assertEqual(5); - hashSet.clear(); - let res1 = hashSet.length; - expect(res1).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let hashSet = new HashSet(); - let res = hashSet.clear(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse the collection of all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(2); - hashSet.add(3); - hashSet.add(4); - hashSet.add(5); - let arr = []; - hashSet.forEach((value, index) => { - arr.push(value); - }); - for (let i = 0; i < arr.length; i++) { - let has = hashSet.has(arr[i]); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traverse the collection of all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach002", 0, function () { - let hashSet = new HashSet(); - let arr = []; - hashSet.forEach((value, index) => { - arr.push(value); - }); - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.number: TEST_FOR_EACH_003 - * @tc.name : testForEach003 - * @tc.desc : Traverse the collection of all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach003", 0, function () { - let hashSet = new HashSet(); - for (let i = 0; i < 100; i++) { - hashSet.add(i); - } - let arr = []; - hashSet.forEach((value, index) => { - arr.push(value); - }); - for (let i = 0; i < 100; i++) { - let a = arr[i]; - let res = hashSet.has(a); - expect(res).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_004 - * @tc.name : testForEach004 - * @tc.desc : Traverse the collection of all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach004", 0, function () { - let hashSet = new HashSet(); - try { - hashSet.forEach.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The forEach method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Get a collection of all elements of a HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testValues001", 0, function () { - let hashSet = new HashSet(); - hashSet.add("A"); - hashSet.add("B"); - hashSet.add("C"); - hashSet.add("D"); - hashSet.add("E"); - let res = hashSet.values(); - for (let i = 0; i < hashSet.length; i++) { - let has = hashSet.has(res.next().value); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Iterate over all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(2); - hashSet.add(3); - hashSet.add(4); - hashSet.add(5); - let res = hashSet.entries(); - for (let i = 0; i < hashSet.length; i++) { - let has = hashSet.has(res.next().value[1]); - expect(has).assertEqual(true); - } - }); - - /** - * @tc.number: TEST_ENTRIES_002 - * @tc.name : testEntries002 - * @tc.desc : Iterate over all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries002", 0, function () { - let hashSet = new HashSet(); - let res = hashSet.entries(); - expect(res.next().value).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all elements of the HashSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let hashSet = new HashSet(); - hashSet.add(1); - hashSet.add(2); - hashSet.add(3); - hashSet.add(4); - hashSet.add(5); - let res = hashSet[Symbol.iterator](); - let temp = undefined; - let arr = []; - do { - temp = res.next().value; - arr.push(temp); - } while (temp != undefined); - arr.sort(function (a, b) { - return a - b; - }); - let arr1 = [1, 2, 3, 4, 5]; - for (let i = 0; i < arr.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index aa6b91ae977893308895d725c3d734a2d499a34c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import HashSetTest from './HashSet.test' - -export default function testsuite() { - HashSetTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryhashsetetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/app.json deleted file mode 100644 index 9bdcc21b3e037558df59b8486b47b44e333b9a7f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.plainarray.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/BUILD.gn deleted file mode 100644 index e220b255e7d3b1bc1cf8c1897bacb28e37226787..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformPlainArrayTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformPlainArrayTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/Test.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/Test.json deleted file mode 100644 index a2adede2bd586c2d6218cfb792a7058c0062d3b2..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.plainarray.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformPlainArrayTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/signature/openharmony_sx.p7b deleted file mode 100644 index 1813c307e219b9e961f29738ded7c678acddc931..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 5809430e505edc67859b3a185cd978eaa373f40b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import PlainArrayTest from './PlainArray.test' - -export default function testsuite() { - PlainArrayTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/PlainArray.test.ets b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/PlainArray.test.ets deleted file mode 100644 index 9390ac04f5010135ca133c6b423c32cefdc3b49b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/ets/test/PlainArray.test.ets +++ /dev/null @@ -1,790 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import PlainArray from "@ohos.util.PlainArray"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -export default function PlainArrayTest() { - describe("PlainArrayTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an PlainArray instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let plainArray = new PlainArray(); - expect(plainArray != null).assertTrue(); - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of key value pairs in the PlainArray instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 0 - */ - it("testLength001", 0, function () { - let plainArray = new PlainArray(); - let res = plainArray.length; - expect(res).assertEqual(0); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - res = plainArray.length; - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - let res = plainArray.get(1); - expect(res).assertEqual("A"); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let plainArray = new PlainArray(); - let a = [1, 2, 3, 4]; - plainArray.add(2, a); - let res = plainArray.get(2); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let plainArray = new PlainArray(); - let c = { name: "lili", age: "13" }; - plainArray.add(1, c); - let res = plainArray.get(1); - expect(res).assertEqual(c); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let plainArray = new PlainArray(); - let c = false; - plainArray.add(1, c); - let res = plainArray.get(1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, 3); - let res = plainArray.get(1); - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, 3.1); - let res = plainArray.get(1); - expect(res).assertEqual(3.1); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, null); - let res = plainArray.get(1); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let plainArray = new PlainArray(); - for (let i = 0; i < 100; i++) { - plainArray.add(i, i + 1); - } - let res = plainArray.get(1); - let res1 = plainArray.length; - expect(res).assertEqual(2); - expect(res1).assertEqual(100); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let plainArray = new PlainArray(); - for (let i = 0; i < 1000; i++) { - plainArray.add(i, i + 1); - } - let res = plainArray.get(99); - let res1 = plainArray.length; - expect(res).assertEqual(100); - expect(res1).assertEqual(1000); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(3, "a"); - plainArray.add(1, "b"); - plainArray.add(2, "c"); - plainArray.add(5, "d"); - plainArray.add(4, "e"); - let res = plainArray.get(2); - expect(res).assertEqual("c"); - }); - - /** - * @tc.number: TEST_ADD_011 - * @tc.name : testAdd011 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd011", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "ABCd"); - plainArray.add(2, "~!@#$^&*()_+-*/=.?<>:;|{}[]"); - plainArray.add(3, null); - plainArray.add(4, undefined); - plainArray.add(5, []); - plainArray.add(6, {}); - plainArray.add(7, true); - plainArray.add(8, 1234); - plainArray.add(9, 1.234); - plainArray.add(10, -1234); - let res = plainArray.get(2); - expect(res).assertEqual("~!@#$^&*()_+-*/=.?<>:;|{}[]"); - }); - - /** - * @tc.number: TEST_ADD_012 - * @tc.name : testAdd012 - * @tc.desc : Add a pair of key value pairs to the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd012", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, 1); - plainArray.add(2, "b"); - plainArray.add(3, true); - plainArray.add(4, [1, 2, 3, 4]); - plainArray.add(5, { name: "lili", age: "13" }); - plainArray.add(6, undefined); - plainArray.add(7, null); - let res = plainArray.get(2); - expect(res).assertEqual("b"); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all key value pairs in PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.length; - expect(res).assertEqual(5); - plainArray.clear(); - let res1 = plainArray.length; - expect(res1).assertEqual(0); - plainArray.clear(); - let res2 = plainArray.length; - expect(res2).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLONE_001 - * @tc.name : testClone001 - * @tc.desc : Clone an PlainArray instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClone001", 0, function () { - let plainArray = new PlainArray(); - let clonePlainarray = plainArray.clone(); - let cloneLength = clonePlainarray.length; - expect(cloneLength).assertEqual(0); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.clone(); - let arr = []; - res.forEach((value, index) => { - arr.push(value); - }); - let arr1 = ["A", "B", "C", "D", "E"]; - for (let i = 0; i < arr.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Check whether the PlainArray contains a specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.has(6); - expect(res).assertEqual(false); - let res1 = plainArray.has(1); - expect(res1).assertEqual(true); - }); - - /** - * @tc.number: TEST_GET_001 - * @tc.name : testGet001 - * @tc.desc : Get the corresponding value through the key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.get(4); - expect(res).assertEqual("D"); - res = plainArray.get(10); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_002 - * @tc.name : testGet002 - * @tc.desc : Get the corresponding value through the key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGet002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.get(8); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_KEY_001 - * @tc.name : testGetIndexOfKey001 - * @tc.desc : Find the index of the key value pair according to the corresponding key. - * If no key is specified, return -1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOfKey001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getIndexOfKey(2); - expect(res).assertEqual(1); - res = plainArray.getIndexOfKey(12); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_KEY_002 - * @tc.name : testGetIndexOfKey002 - * @tc.desc : Find the index of the key value pair according to the corresponding key. - * If no key is specified, return -1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOfKey002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getIndexOfKey(9); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_VALUE_001 - * @tc.name : testGetIndexOfValue001 - * @tc.desc : Find the index of the key value pair according to the corresponding key. - * If no key is specified, return -1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOfValue001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getIndexOfValue("A"); - expect(res).assertEqual(0); - res = plainArray.getIndexOfValue("Z"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_GET_INDEX_OF_VALUE_002 - * @tc.name : testGetIndexOfValue002 - * @tc.desc : Find the index of the key value pair according to the corresponding key. - * If no key is specified, return -1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetIndexOfValue002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getIndexOfValue("Asad"); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the PlainArray instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let plainArray = new PlainArray(); - let result = plainArray.length; - expect(result).assertEqual(0); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_GET_KEY_AT_001 - * @tc.name : testGetKeyAt001 - * @tc.desc : Find the key of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetKeyAt001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getKeyAt(2); - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_GET_KEY_AT_002 - * @tc.name : testGetKeyAt002 - * @tc.desc : Find the key of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetKeyAt002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getKeyAt(50); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete key value pairs according to key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.remove(2); - expect(res).assertEqual("B"); - let value = plainArray.get(2); - expect(value).assertEqual(undefined); - res = plainArray.remove(12); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete key value pairs according to key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let plainArray = new PlainArray(); - let res = plainArray.remove(2); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_AT_001 - * @tc.name : testReMoveAt001 - * @tc.desc : Delete key value pairs according to index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveAt001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.removeAt(2); - expect(res).assertEqual("C"); - let value = plainArray.get(3); - expect(value).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_AT_002 - * @tc.name : testReMoveAt002 - * @tc.desc : Delete key value pairs according to index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveAt002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.removeAt(12); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_REMOVE_RANGE_FROM_001 - * @tc.name : testRemoveRangeFrom001 - * @tc.desc : Deletes the specified number of elements from the specified starting index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemoveRangeFrom001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - plainArray.removeRangeFrom(0, 5); - let res = plainArray.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_SET_VALUE_AT_001 - * @tc.name : testSetValueAt001 - * @tc.desc : Modify the value of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetValueAt001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - plainArray.setValueAt(2, "V"); - let keys = [1, 2, 3, 4, 5]; - let values = ["A", "B", "V", "D", "E"]; - for (let i = 0; i < keys.length; i++) { - expect(values[i]).assertEqual(plainArray.get(keys[i])); - } - try { - plainArray.setValueAt(-1, "X"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: -1`); - } - }); - - /** - * @tc.number: TEST_SET_VALUE_AT_002 - * @tc.name : testSetValueAt002 - * @tc.desc : Modify the value of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetValueAt002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - try { - plainArray.setValueAt(8, "V"); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 8`); - } - }); - - /** - * @tc.number: TEST_TO_STRING_001 - * @tc.name : testToString001 - * @tc.desc : Use "," to splice the elements in the LightWeightMap instance into a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString001", 0, function () { - let plainArray = new PlainArray(); - let res1 = plainArray.toString(); - expect(res1).assertEqual(""); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - let res = plainArray.toString(); - expect(res).assertEqual("1:A,2:B,3:C"); - }); - - /** - * @tc.number: TEST_GET_VALUE_001 - * @tc.name : testGetValueAt001 - * @tc.desc : Get the value of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetValueAt001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let res = plainArray.getValueAt(2); - expect(res).assertEqual("C"); - }); - - /** - * @tc.number: TEST_GET_VALUE_002 - * @tc.name : testGetValueAt002 - * @tc.desc : Get the value of the key value pair according to the corresponding index. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetValueAt002", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - try { - plainArray.getValueAt(50); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200001); - expect(err.message).assertEqual(`The value of "index" is out of range. It must be >= 0 && <= 4. Received value is: 50`); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse all key value pairs in the PlainArray instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let arr = []; - plainArray.forEach((value, index) => { - arr.push(value); - }); - let arr1 = ["A", "B", "C", "D", "E"]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all key value pairs in the PlainArray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let plainArray = new PlainArray(); - plainArray.add(1, "A"); - plainArray.add(2, "B"); - plainArray.add(3, "C"); - plainArray.add(4, "D"); - plainArray.add(5, "E"); - let iters = plainArray[Symbol.iterator](); - let flag = true; - for (let i = 0, len = plainArray.length; i < len; i++) { - let entry = iters.next().value; - let res = plainArray.get(entry[0]); - if (res != entry[1]) { - flag = false; - break; - } - } - expect(flag).assertEqual(true); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryplainarrayetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/app.json deleted file mode 100755 index 9359991d6e43b9be586d30f0eac22b72c8e6d511..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.process.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryprocessetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryprocessetstest/BUILD.gn deleted file mode 100755 index 74d68c71588a293e73bddcf6f02b7326dfca1968..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformProcessTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformProcessTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/Test.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/Test.json deleted file mode 100755 index 36db51edcfe1b8e25ff5057f9b8b8ac3fd798af8..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - - "driver": { - "type": "OHJSUnitTest", - - "test-timeout": "60000", - - "shell-timeout": "60000", - - "bundle-name": "ohos.acts.commonlibrary.crossplatform.process.normal", - - "module-name": "entry_test" - - - }, - - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformProcessTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryprocessetstest/signature/openharmony_sx.p7b deleted file mode 100755 index d84e65f95f356a748b67031d7d7bb4d5e05bd6e1..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryprocessetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index a535e83f79f890b0209acbfa7d873fd4de72104b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index b2e5d7129609956f4920cb7d987e5e8b477e7466..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import ProcessTest from './Process.test.ets' - -export default function testsuite() { - ProcessTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/Process.test.ets b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/Process.test.ets deleted file mode 100755 index 6bdfc78b4e3491ee4ecc89f972d382c13cebcf36..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/ets/test/Process.test.ets +++ /dev/null @@ -1,1292 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -import process from '@ohos.process' -export default function ProcessTest() { -describe('ProcessManager', function () { - - /** - * @tc.number:TEST_IS_APPUID_001 - * @tc.name: testProcessManagerIsAppUid001 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsAppUid001', 0, function () { - let pro = new process.ProcessManager(); - let isorno = pro.isAppUid(167); - expect(isorno).assertEqual(false); - }) - - - - /** - * @tc.number:TEST_PROCESSMAMAGER_IS_APPUID_002 - * @tc.name: testProcessManagerIsAppUid002 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsAppUid002', 0, function () { - let pro = new process.ProcessManager(); - let isorno = pro.isAppUid(80000); - expect(isorno).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMAMAGER_IS_APPUID_003 - * @tc.name: testProcessManagerIsAppUid003 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsappuid003', 0, function () { - let pro = new process.ProcessManager(); - let isorno = pro.isAppUid(123); - expect(isorno).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMAMAGER_IS_APPUID_004 - * @tc.name: testProcessManagerIsAppUid004 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsappuid004', 0, function () { - let pro = new process.ProcessManager(); - let isorno = pro.isAppUid(789); - expect(isorno).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMAMAGER_IS_APPUID_005 - * @tc.name: testProcessManagerIsAppUid004 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsappuid005', 0, function () { - let pro = new process.ProcessManager(); - let isorno = pro.isAppUid(8569); - expect(isorno).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMAMAGER_IS_APPUID_006 - * @tc.name: testProcessManagerIsAppUid006 - * @tc.desc: Returns a boolean whether the specified uid belongs to a particular application. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerIsappuid006', 0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let mag = pro.isAppUid("asdad"); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be number."); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETUIDFORNAME_001 - * @tc.name: testProcessManagerGetUidForName001 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetUidForName001',0, function () { - let pro = new process.ProcessManager(); - let pres = pro.getUidForName("root"); - if (pres != -1) { - let flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETUIDFORNAME_002 - * @tc.name: testProcessManagerGetUidForName002 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetUidForName002', 0, function () { - let pro = new process.ProcessManager(); - for (let i=0; i<3; i++) { - let pres = pro.getUidForName("12356"); - expect(pres).assertEqual(-1); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETUIDFORNAME_003 - * @tc.name: testProcessManagerGetUidForName003 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetUidForName003', 0, function () { - let pro = new process.ProcessManager(); - for (let i=0; i<5; i++) { - let pres = pro.getUidForName("as123"); - expect(pres).assertEqual(-1); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETUIDFORNAME_004 - * @tc.name: testGetUidForName004 - * @tc.desc: Returns the uid based on the specified user name. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetUidForName004',0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let pres = pro.getUidForName(12); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be string."); - } - }) - - - - /** - * @tc.number:TEST_PROCESSMANAGER_GETTHREADPRIORITY_001 - * @tc.name: testProcessManagerGetThreadPriority001 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetThreadPriority001', 0, function () { - let pro = new process.ProcessManager(); - let pres = process.tid; - let pri = pro.getThreadPriority(pres); - if (pri) { - let flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETTHREADPRIORITY_002 - * @tc.name: testProcessManagerGetThreadPriority002 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetThreadPriority002', 0, function () { - let pro = new process.ProcessManager(); - let pres = process.tid; - for (let i=0; i<3; i++) { - let pri = pro.getThreadPriority(pres); - if (pri > 0) { - let flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETTHREADPRIORITY_003 - * @tc.name: testProcessManagerGetThreadPriority003 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetThreadPriority003', 0, function () { - let pro = new process.ProcessManager(); - let pres = process.tid; - for (let i=0; i<5; i++) { - let pri = pro.getThreadPriority(pres); - if (pri > 0) { - let flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETTHREADPRIORITY_004 - * @tc.name: testProcessManagerGetThreadPriority004 - * @tc.desc: Returns the thread priority based on the specified tid. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetThreadPriority004', 0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let pri = pro.getThreadPriority("asdad"); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be number."); - } - }) - - - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_001 - * @tc.name: testProcessManagerGetSystemConfig001 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig001', 0, function () { - let pro = new process.ProcessManager(); - let _SC_ARG_MAX = 0; - let pri = pro.getSystemConfig(_SC_ARG_MAX); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_002 - * @tc.name: testProcessManagerGetSystemConfig002 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig002', 0, function () { - let pro = new process.ProcessManager(); - let _SC_ARG_MAX = 0; - for (let i=0; i<3; i++) { - let pri = pro.getSystemConfig(_SC_ARG_MAX); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_003 - * @tc.name: testProcessManagerGetSystemConfig003 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig003', 0, function () { - let pro = new process.ProcessManager(); - let _SC_ARG_MAX = 0; - for (let i=0; i<5; i++) { - let pri = pro.getSystemConfig(_SC_ARG_MAX); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_004 - * @tc.name: testProcessManagerGetSystemConfig004 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig004', 0, function () { - let pro = new process.ProcessManager(); - let _SC_OPEN_MAX = 4 - let pri = pro.getSystemConfig(_SC_OPEN_MAX); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_005 - * @tc.name: testProcessManagerGetSystemConfig005 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig005', 0, function () { - let pro = new process.ProcessManager(); - let _SC_PAGESIZE = 8; - let pri = pro.getSystemConfig(_SC_PAGESIZE); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETSYSTEMCONFIG_006 - * @tc.name: testGetSystemConfig006 - * @tc.desc: Returns the system configuration at runtime. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetSystemConfig006', 0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let pri = pro.getSystemConfig("asdad"); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be number."); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETENVIRONMENTVAR_001 - * @tc.name: testProcessManagerGetEnvironmentVar001 - * @tc.desc: Returns the system value for environment variables. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetEnvironmentVar001', 0, function () { - let pro = new process.ProcessManager(); - let pri = pro.getEnvironmentVar("USER"); - if (pri != null) { - var flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETENVIRONMENTVAR_002 - * @tc.name: testProcessManagerGetEnvironmentVar002 - * @tc.desc: Returns the system value for environment variables. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetEnvironmentVar002', 0, function () { - let pro = new process.ProcessManager(); - for (let i=0; i<3; i++) { - let pri = pro.getEnvironmentVar("PATH"); - if (pri != null) { - var flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETENVIRONMENTVAR_003 - * @tc.name: testProcessManagerGetEnvironmentVar003 - * @tc.desc: Returns the system value for environment variables. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetEnvironmentVar003', 0, function () { - let pro = new process.ProcessManager(); - for (let i=0; i<100; i++) { - let pri = pro.getEnvironmentVar("i123"); - if (pri == null) { - var flag = new Boolean(true); - expect(Boolean(flag)).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_GETENVIRONMENTVAR_004 - * @tc.name: testGetEnvironmentVar004 - * @tc.desc: Returns the system value for environment variables. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerGetEnvironmentVar004', 0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let pri = pro.getEnvironmentVar(123); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be string."); - } - }) - - - /** - * @tc.number:TEST_PROCESSMANAGER_KILL_001 - * @tc.name: testProcessManagerKill001 - * @tc.desc: Return whether the signal was sent successfully. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerKill001', 0, function () { - let pro = new process.ProcessManager(); - let result = pro.kill(3, 123); - expect(result).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_KILL_002 - * @tc.name: testProcessManagerKill002 - * @tc.desc: Return whether the signal was sent successfully. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerKill002', 0, function () { - let pro = new process.ProcessManager(); - let pres = process.pid; - let result = pro.kill(23, pres); - expect(result).assertEqual(true); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_KILL_003 - * @tc.name: testProcessManagerKill003 - * @tc.desc: Return whether the signal was sent successfully. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerKill003', 0, function () { - let pro = new process.ProcessManager(); - let pres = process.pid; - let result = pro.kill(28, pres); - expect(result).assertEqual(true); - }) - - - /** - * @tc.number:TEST_PROCESSMANAGER_KILL_004 - * @tc.name: testProcessManagerKill004 - * @tc.desc: Return whether the signal was sent successfully. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerKill004', 0, function () { - let pro = new process.ProcessManager(); - let result = pro.kill(3, 113); - expect(result).assertEqual(false); - }) - - /** - * @tc.number:TEST_PROCESSMANAGER_KILL_005 - * @tc.name: testProcessManagerKill005 - * @tc.desc: Return whether the signal was sent successfully. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testProcessManagerKill005', 0, function () { - try { - let pro = new process.ProcessManager(); - //@ts-ignore - let result = pro.kill("asd", 123); - } catch (e) { - expect(e.toString()).assertEqual("BuisnessError: The type of v must be number."); - } - }) -}) - - - -describe('ProcessTest', function () { - - /** - * @tc.number:TEST_EGID_001 - * @tc.name: testEgid001 - * @tc.desc: Returns the numeric valid group ID of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testEgid001', 0, function () { - let result = process.egid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_EGID_002 - * @tc.name: testEgid002 - * @tc.desc: Returns the numeric valid group ID of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testEgid002', 0, function () { - for (let i = 0; i < 3; i++) { - let result = process.egid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - - /** - * @tc.number:TEST_EUID_001 - * @tc.name: testEuid001 - * @tc.desc: Return the numeric valid user identity of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testEuid001', 0, function () { - let result = process.euid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_EUID_002 - * @tc.name: testEuid002 - * @tc.desc: Return the numeric valid user identity of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid002', 0, function () { - for (let i = 0; i < 3; i++) { - let result = process.euid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_GID_001 - * @tc.name: testGid001 - * @tc.desc: Return the numeric group if of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - - it('testGid001', 0, function () { - let result = process.gid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_GID_002 - * @tc.name: testGid002 - * @tc.desc: Return the numeric group if of the process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testGid002', 0, function () { - for (let i = 0; i < 3; i++) { - let result = process.gid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_Uid_001 - * @tc.name: testUid001 - * @tc.desc: returns the digital user id of the process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid001', 0, function () { - let result = process.uid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_Uid_002 - * @tc.name: testUid002 - * @tc.desc: returns the digital user id of the process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid002', 0, function () { - for (let i = 0; i < 3; i++) { - let result = process.uid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_Uid_003 - * @tc.name: testUid003 - * @tc.desc: returns the digital user id of the process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid003', 0, function () { - for (let i = 0; i < 6; i++) { - let result = process.uid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_Uid_004 - * @tc.name: testUid004 - * @tc.desc: returns the digital user id of the process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid004', 0, function () { - for (let i = 0; i < 8; i++) { - let result = process.uid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_Uid_005 - * @tc.name: testUid005 - * @tc.desc: returns the digital user id of the process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testUid005', 0, function () { - for (let i = 0; i < 5; i++){ - let result = process.uid; - if (result != null) { - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - } - }) - - /** - * @tc.number:TEST_GROUPS_001 - * @tc.name: testGroups001 - * @tc.desc: Return an array with supplementary group id - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testGroups001', 0, function () { - let result = process.groups; - if (result != null) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - - /** - * @tc.number:TEST_PID_001 - * @tc.name: testPid001 - * @tc.desc: Return pid is the pid of the current process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPid001', 0, function () { - let result = process.pid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_PID_002 - * @tc.name: testPid002 - * @tc.desc: Return pid is the pid of the current process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPid002', 0, function () { - for (let i = 0; i < 3; i++) { - let result = process.pid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PID_003 - * @tc.name: testPid003 - * @tc.desc: Return pid is the pid of the current process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPid003', 0, function () { - for (let i = 0; i < 5; i++) { - let result = process.pid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PID_004 - * @tc.name: testPid004 - * @tc.desc: Return pid is the pid of the current process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPid004', 0, function () { - for (let i = 0; i < 6; i++) { - let result = process.pid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_PID_005 - * @tc.name: testPid005 - * @tc.desc: Return pid is the pid of the current process. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPid005', 0, function () { - for (let i = 0; i < 8; i++) { - let result = process.pid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - }) - - - - /** - * @tc.number:TEST_PPID_001 - * @tc.name: testPpid001 - * @tc.desc: Return ppid is The pid of the current child process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testTid001', 0, function () { - let pres = process.ppid; - if (pres > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_PPID_002 - * @tc.name: testPpid002 - * @tc.desc: Return ppid is The pid of the current child process - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testPpid002', 0, function () { - for (let i = 0; i < 8; i++) { - let result = process.ppid; - if (result > 0) { - var flag = true; - } - expect(flag).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_TID_001 - * @tc.name: testTid001 - * @tc.desc: Returns the tid of the current thread. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testTid001', 0, function () { - let pres = process.tid; - if (pres > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_TID_002 - * @tc.name: testTid002 - * @tc.desc: Returns the tid of the current thread. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testTid002', 0, function () { - for (let i=0; i < 5; i++) { - let pres = process.tid; - if (pres > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_TID_003 - * @tc.name: testTid003 - * @tc.desc: Returns the tid of the current thread. - * @tc.size: MediumTest - * @tc.type: Constant - * @tc.level: level 2 - */ - it('testTid003', 0, function () { - for (let i=0; i < 3; i++) { - let pres = process.tid; - if (pres > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_IS64BIT_001 - * @tc.name: testIs64Bit001 - * @tc.desc: Returns a boolean whether the process is running in a 64-bit environment. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testIs64Bit001', 0, function () { - let isorno = process.is64Bit(); - if (isorno) { - expect(isorno).assertEqual(true); - } else { - expect(isorno).assertEqual(false); - } - }) - - /** - * @tc.number:TEST_IS64BIT_002 - * @tc.name: testIs64Bit002 - * @tc.desc: Returns a boolean whether the process is running in a 64-bit environment. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testIs64Bit002', 0, function () { - for (let i=0; i<3; i++) { - let isorno = process.is64Bit(); - if (isorno) { - expect(isorno).assertEqual(true); - } else { - expect(isorno).assertEqual(false); - } - } - }) - - /** - * @tc.number:TEST_IS64BIT_003 - * @tc.name: testIs64Bit003 - * @tc.desc: Returns a boolean whether the process is running in a 64-bit environment. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testIs64Bit003', 0, function () { - for (let i=0; i<5; i++) { - let isorno = process.is64Bit(); - if (isorno) { - expect(isorno).assertEqual(true); - } else { - expect(isorno).assertEqual(false); - } - } - }) - - - /** - * @tc.number:TEST_GET_START_REALTIME_001 - * @tc.name: testGetStartRealtime001 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetStartRealtime001', 0, function () { - for (let i=0; i<3; i++) { - let pri = process.getStartRealtime(); - if (pri !== null) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_GET_START_REALTIME_002 - * @tc.name: testGetStartRealtime002 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetStartRealtime002', 0, function () { - let pri = process.getStartRealtime(); - if (pri !== null) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_GET_START_REALTIME_003 - * @tc.name: testGetStartRealtime003 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetStartRealtime003', 0, function () { - for (let i=0; i<5; i++) { - let pri = process.getStartRealtime(); - if (pri !== null) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_GET_START_REALTIME_004 - * @tc.name: testGetStartRealtime004 - * @tc.desc: Returns the elapsed real time (in milliseconds) - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetStartRealtime004', 0, function () { - for (let i=0; i<8; i++) { - let pri = process.getStartRealtime(); - if (pri !== null) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_GET_START_REALTIME_005 - * @tc.name: testGetStartRealtime005 - * @tc.desc: Returns the elapsed real time (in milliseconds) taken from the start of - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetStartRealtime005', 0, function () { - for (let i=0; i<6; i++) { - let pri = process.getStartRealtime(); - if (pri !== null) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - - /** - * @tc.number:TEST_GET_PAST_CPU_TIME_001 - * @tc.name: testGetpastCpuTime001 - * @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetpastCpuTime001', 0, function () { - for (let i=0; i<3; i++) { - let pri = process.getPastCpuTime(); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_GET_PAST_CPU_TIME_002 - * @tc.name: testGetpastCpuTime002 - * @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetpastCpuTime002', 0, function () { - let pri = process.getPastCpuTime(); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - }) - - /** - * @tc.number:TEST_GET_PAST_CPU_TIME_003 - * @tc.name: testGetpastCpuTime003 - * @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetpastCpuTime003', 0, function () { - for (let i=0; i<5; i++) { - let pri = process.getPastCpuTime(); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - /** - * @tc.number:TEST_GET_PAST_CPU_TIME_004 - * @tc.name: testGetpastCpuTime004 - * @tc.desc: Returns the cpu time (in milliseconds) from the time when the process starts to the current time. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testGetpastCpuTime004', 0, function () { - for (let i=0; i<8; i++) { - let pri = process.getPastCpuTime(); - if (pri > 0) { - var flag = new Boolean(true); - } - expect(Boolean(flag)).assertEqual(true); - } - }) - - - /** - * @tc.number:TEST_CWD_001 - * @tc.name: testCwd001 - * @tc.desc: Return the current work directory - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - - it('testCwd001', 0, function () { - let result=process.cwd(); - expect(result!=null).assertTrue(); - }) - - - /** - * @tc.number:TEST_CHDIR_001 - * @tc.name: testChdir001 - * @tc.desc: Change current directory - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - - it('testChdir001', 0, function () { - let result=process.cwd(); - let result1=process.chdir(result); - expect(result!=null).assertTrue(); - }) - - - /** - * @tc.number:TEST_UPTIME_001 - * @tc.name: testUptime001 - * @tc.desc: Returns the running time of the system. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testUptime001', 0, function () { - let result1 = process.uptime(); - function sleep(d){ - while(process.uptime() - result1 <= d); - } - sleep(6); - let result2 = process.uptime(); - var flag = false - if ((result2 - result1) >= 6) { - flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_UPTIME_002 - * @tc.name: testUptime002 - * @tc.desc: Returns the running time of the system. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testUptime002', 0, function () { - let result1 = process.uptime(); - function sleep(d){ - while (process.uptime() - result1 <= d); - } - sleep(8); - let result2 = process.uptime(); - var flag = false; - if ((result2 - result1) >= 8) { - flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_UPTIME_003 - * @tc.name: testUptime003 - * @tc.desc: Returns the running time of the system. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testUptime003', 0, function () { - let result1 = process.uptime(); - function sleep(d){ - while (process.uptime() - result1 <= d); - } - sleep(10); - let result2 = process.uptime(); - var flag = false; - if ((result2 - result1) >= 10) { - flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_UPTIME_004 - * @tc.name: testUptime004 - * @tc.desc: Returns the running time of the system. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testUptime004', 0, function () { - let result1 = process.uptime(); - function sleep(d){ - while (process.uptime() - result1 <= d); - } - sleep(7); - let result2 = process.uptime(); - var flag = false; - if ((result2 - result1) >= 7) { - flag = true; - } - expect(flag).assertEqual(true); - }) - - /** - * @tc.number:TEST_UPTIME_005 - * @tc.name: testUptime005 - * @tc.desc: Returns the running time of the system. - * @tc.size: MediumTest - * @tc.type: Method - * @tc.level: level 2 - */ - it('testUptime005', 0, function () { - let result1 = process.uptime(); - function sleep(d){ - while (process.uptime() - result1 <= d); - } - sleep(11); - let result2 = process.uptime(); - var flag = false; - if ((result2 - result1) >= 11) { - flag = true; - } - expect(flag).assertEqual(true); - }) -}) -} - - - - - - - - - - - \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/module.json deleted file mode 100755 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryprocessetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/app.json deleted file mode 100755 index 59f848377521834949267484a4abac75ebb0cf2a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.queue.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/element/string.json deleted file mode 100755 index c96ccdb143584bd27a7af38f3e3b5200c09d0d07..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryqueueetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryqueueetstest/BUILD.gn deleted file mode 100755 index 14454dd4ba2b384104e184932b204dd79322084f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformCommonlibraryQueueTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCrossplatformCommonlibraryQueueTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - sources = [ "src/main/resources" ] - deps = [ ":windowStage_app_profile" ] - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/Test.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/Test.json deleted file mode 100755 index 8d87e61f90dd246b43efdc455133e924de04dbdc..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.queue.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformCommonlibraryQueueTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryqueueetstest/signature/openharmony_sx.p7b deleted file mode 100755 index ea52dad48e843b330d382b993bde77b5f59b7b92..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryqueueetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 34e37eb84f3033ea9f3be16336152223801e2e4a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 82eb2048efc21bba6a4a61674d1e5ca2c3b8321b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 61b179c9d6d73e720e21301b1c6b883529df80b9..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import QueueTest from './Queue.test' - -export default function testsuite() { - QueueTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/Queue.test.ets b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/Queue.test.ets deleted file mode 100755 index 93caee0187a5fb75502df93906070e1c1c6fd7de..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/ets/test/Queue.test.ets +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import Queue from "@ohos.util.Queue"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function QueueTest() { -describe("QueueTest", function () { - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name: testConstructor001 - * @tc.desc: Create an Queue instance. For example: let queue = new Queue(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testConstructor001", 0, function () { - try { - let queue = new Queue(); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The Queue's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name: testAdd001 - * @tc.desc: Add element to Queue instance end. For example: queue.add("四"). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd001", 0, function () { - let queue = new Queue(); - queue.add("四"); - let res = queue.getFirst(); - expect(res).assertEqual("四"); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name: testAdd002 - * @tc.desc: Add element to Queue instance end. For example: queue.add(8). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd002", 0, function () { - let queue = new Queue(); - queue.add(8); - let res = queue.getFirst(); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name: testAdd003 - * @tc.desc: Add element to Queue instance end. For example: queue.add(8). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd003", 0, function () { - let queue = new Queue(); - let a = ["a", "b", "c"]; - queue.add(a); - let res = queue.getFirst(); - expect(res).assertEqual(a); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name: testAdd004 - * @tc.desc: Add element to Queue instance end. For example: queue.add("$"). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd004", 0, function () { - let queue = new Queue(); - queue.add("$"); - let res = queue.getFirst(); - expect(res).assertEqual("$"); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name: testAdd005 - * @tc.desc: Add element to Queue instance end. For example: queue.add(" "). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd005", 0, function () { - let queue = new Queue(); - queue.add(" "); - let res = queue.getFirst(); - expect(res).assertEqual(" "); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name: testAdd006 - * @tc.desc: Add element to Queue instance end. For example: queue.add(null). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd006", 0, function () { - let queue = new Queue(); - queue.add(null); - let res = queue.getFirst(); - expect(res).assertEqual(null); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name: testAdd007 - * @tc.desc: Add element to Queue instance end. For example: queue.add(undefined). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd007", 0, function () { - let queue = new Queue(); - queue.add(undefined); - let res = queue.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name: testAdd008 - * @tc.desc: Add element to Queue instance end. For example: for (let i = 0; i < 100; i++) { queue.add(i);}. - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd008", 0, function () { - let queue = new Queue(); - for (let i = 0; i < 100; i++) { - queue.add(i); - } - let res = queue.length; - expect(res).assertEqual(100); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name: testAdd009 - * @tc.desc: Add element to Queue instance end. For example: queue.add.bind({}, 10)(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testAdd009", 0, function () { - let queue = new Queue(); - try { - queue.add.bind({}, 10)(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_GET_FIRST_001 - * @tc.name: testGetFirst001 - * @tc.desc: Get the header element of the queue instance. For example: queue.getFirst(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testGetFirst001", 0, function () { - let queue = new Queue(); - queue.add(6); - queue.add("四"); - let res = queue.getFirst(); - expect(res).assertEqual(6); - }); - - /** - * @tc.number: TEST_GET_FIRST_002 - * @tc.name: testGetFirst002 - * @tc.desc: Get the header element of the queue instance. For example: queue.getFirst(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testGetFirst002", 0, function () { - let queue = new Queue(); - let res = queue.getFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_POP_001 - * @tc.name: testPop001 - * @tc.desc: Delete the header element of a queue instance. For example: queue.pop(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testPop001", 0, function () { - let queue = new Queue(); - queue.add(6); - queue.add("四"); - let res = queue.pop(); - let res1 = queue.getFirst(); - expect(res).assertEqual(6); - expect(res1).assertEqual("四"); - }); - - /** - * @tc.number: TEST_POP_002 - * @tc.name: testPop002 - * @tc.desc: Delete the header element of a queue instance. For example: queue.pop(). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testPop002", 0, function () { - let queue = new Queue(); - let res = queue.pop(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_FOREACH_001 - * @tc.name: testForEach001 - * @tc.desc: Traversing elements in queue instances. For example: queue.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testForEach001", 0, function () { - let queue = new Queue(); - queue.add(8); - queue.add("一"); - queue.add("二"); - queue.add(1); - queue.add(2); - queue.add(3); - queue.add(4); - queue.add(5); - queue.add(6); - let c = ["a", "b", "c", "d"]; - queue.add(c); - let arr = []; - queue.forEach((item, index) => { - arr.push(item); - }); - let a = [8, "一", "二", 1, 2, 3, 4, 5, 6, c]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_FOREACH_002 - * @tc.name: testForEach002 - * @tc.desc: Traversing elements in queue instances. For example: queue.forEach((item, index) => {arr.push(item);}). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testForEach002", 0, function () { - let queue = new Queue(); - let arr = []; - queue.forEach((item, index) => { - arr.push(item); - }); - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name: testIterator001 - * @tc.desc: Iterate over all elements in the queue instance. For example: for (let item of queue) { arr.push(item);}. - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testIterator001", 0, function () { - let queue = new Queue(); - queue.add(8); - queue.add("一"); - queue.add("二"); - queue.add(5); - queue.add(6); - queue.add("三"); - queue.add("四"); - let arr = []; - for (let item of queue) { - arr.push(item); - } - let a = [8, "一", "二", 5, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_ITERATOR_002 - * @tc.name: testIterator002 - * @tc.desc: Iterate over all elements in the queue instance. For example: for (let item of queue) { arr.push(item);}. - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testIterator002", 0, function () { - let queue = new Queue(); - let arr = []; - for (let item of queue) { - arr.push(item); - } - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.number: TEST_ITERATOR_003 - * @tc.name: testIterator003 - * @tc.desc: Iterate over all elements in the queue instance. For example: queue[Symbol.iterator](). - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 2 - */ - it("testIterator003", 0, function () { - let queue = new Queue(); - queue.add(8); - queue.add("一"); - queue.add("二"); - queue.add(5); - queue.add(6); - queue.add("三"); - queue.add("四"); - let arr = []; - let size = queue.length; - let itr = queue[Symbol.iterator](); - for (let i = 0; i < size; i++) { - arr.push(itr.next().value); - } - let a = [8, "一", "二", 5, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name: testLength001 - * @tc.desc: Get the number of elements in the queue instance. For example: queue.length. - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 0 - */ - it("testLength001", 0, function () { - let queue = new Queue(); - queue.add(8); - queue.add("一"); - queue.add("二"); - queue.add(1); - queue.add(2); - queue.add(3); - queue.add(4); - queue.add(5); - queue.add(6); - let res = queue.length; - expect(9).assertEqual(res); - }); - - /** - * @tc.number: TEST_LENGTH_002 - * @tc.name: testLength002 - * @tc.desc: Get the number of elements in the queue instance. For example: queue.length. - * @tc.size: MediumTest - * @tc.type: Function - * @tc.level: Level 0 - */ - it("testLength001", 0, function () { - let queue = new Queue(); - let res = queue.length; - expect(0).assertEqual(res); - }); -}); -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/module.json deleted file mode 100755 index 97abf299e24252ccc8b0b3464cb59dc60eeaca64..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryqueueetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/app.json deleted file mode 100755 index de2ccf11345926f2c30bf6f30430ffe09939b81b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.stack.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/element/string.json deleted file mode 100755 index c96ccdb143584bd27a7af38f3e3b5200c09d0d07..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarystacketstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/BUILD.gn b/commonlibrary/crossplatform/commonlibrarystacketstest/BUILD.gn deleted file mode 100755 index 5b38fda746cdf1a7ee8159c732d4a571d7857e19..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformCommonlibraryStackTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCrossplatformCommonlibraryStackTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - sources = [ "src/main/resources" ] - deps = [ ":windowStage_app_profile" ] - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/Test.json b/commonlibrary/crossplatform/commonlibrarystacketstest/Test.json deleted file mode 100755 index 51fb810a0b082c8d5adffa8d5683cad867a30ccd..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.stack.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformCommonlibraryStackTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibrarystacketstest/signature/openharmony_sx.p7b deleted file mode 100755 index 9b8178a270ebf520d55f5c7369f0bd145437eb32..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarystacketstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 34e37eb84f3033ea9f3be16336152223801e2e4a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 82eb2048efc21bba6a4a61674d1e5ca2c3b8321b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 797d4a8f7f71c09aff391d73d6f4d27f63480d26..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import StackTest from './Stack.test' - -export default function testsuite() { - StackTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/Stack.test.ets b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/Stack.test.ets deleted file mode 100755 index 1a344537efa0f8bf89ab5a3fd30e628ce3e26a17..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/ets/test/Stack.test.ets +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import Stack from "@ohos.util.Stack"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function StackTest() { -describe("StackTest", function () { - - /** - * @tc.name: testConstructor001 - * @tc.desc: Create an Stack instance. For example: let stack = new Stack(). - */ - it("testConstructor001", 0, function () { - try { - let stack = new Stack(); - expect(stack != undefined).assertEqual(true); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200012); - expect(err.message).assertEqual("The Stack's constructor cannot be directly invoked"); - } - }); - - /** - * @tc.name: testPush002 - * @tc.desc: Insert element at top of stack.For example: stack.push("四"). - */ - it("testPush002", 0, function () { - let stack = new Stack(); - stack.push("四"); - let res = stack.peek(); - expect(res).assertEqual("四"); - }); - - /** - * @tc.name: testPush003 - * @tc.desc: Insert element at top of stack.For example: stack.push(8). - */ - it("testPush003", 0, function () { - let stack = new Stack(); - stack.push(8); - let res = stack.peek(); - expect(res).assertEqual(8); - }); - - /** - * @tc.name: testPush004 - * @tc.desc: Insert element at top of stack.For example: let a = {name: "lala", age: "13岁"}; stack.push(a). - */ - it("testPush004", 0, function () { - let stack = new Stack(); - let a = {name: "lala", age: "13岁"}; - stack.push(a); - let res = stack.peek(); - expect(res).assertEqual(a); - }); - - /** - * @tc.name: testPush005 - * @tc.desc: Insert element at top of stack.For example: let a = [1, 2, 3, 4]; stack.push(a). - */ - it("testPush005", 0, function () { - let stack = new Stack(); - let a = [1, 2, 3, 4]; - stack.push(a); - let res = stack.peek(); - expect(res).assertEqual(a); - }); - - /** - * @tc.name: testPeek006 - * @tc.desc: Get stack top element. For example: stack.peek(). - */ - it("testPeek006", 0, function () { - let stack = new Stack(); - let a = [1, 2, 3, 4]; - stack.push(a); - stack.push("A"); - stack.push("B"); - stack.push(1); - let res = stack.peek(); - expect(res).assertEqual(1); - }); - - /** - * @tc.name: testLocate007 - * @tc.desc: Get the index corresponding to the element in the stack. For example: stack.locate("A"). - */ - it("testLocate007", 0, function () { - let stack = new Stack(); - let a = [1, 2, 3, 4]; - stack.push(8); - stack.push(a); - stack.push("A"); - stack.push("B"); - stack.push(1); - let res = stack.locate("A"); - let res1 = stack.locate("C"); - expect(res).assertEqual(2); - expect(res1).assertEqual(-1); - }); - - /** - * @tc.name: testPop008 - * @tc.desc: Delete top of stack element. For example: stack.pop(). - */ - it("testPop008", 0, function () { - let stack = new Stack(); - stack.push("B"); - stack.push(1); - let res = stack.pop(); - let res1 = stack.peek(); - expect(res).assertEqual(1); - expect(res1).assertEqual("B"); - }); - - /** - * @tc.name: testForEach009 - * @tc.desc: Traversing elements in stack instances. For example: stack.forEach((item, index) => {arr.push(item);}). - */ - it("testForEach009", 0, function () { - let stack = new Stack(); - stack.push(8); - stack.push("三"); - stack.push(5); - let c = {name: "lili", age: "13"}; - stack.push(c); - stack.push(6); - stack.push("四"); - let arr = []; - stack.forEach((item, index) => { - arr.push(item); - }); - let a = [8, "三", 5, c, 6, "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.name: testIterator010 - * @tc.desc: Iterate over all elements in the stack instance. For example: for (let item of stack) {arr.push(item);}. - */ - it("testIterator010", 0, function () { - let stack = new Stack(); - stack.push(8); - stack.push("一"); - stack.push("二"); - stack.push(5); - let c = [1, 2, 3, 4]; - stack.push(c); - stack.push(6); - stack.push("三"); - stack.push("四"); - let arr = []; - for (let item of stack) { - arr.push(item); - } - let a = [8, "一", "二", 5, c, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.name: testLength011 - * @tc.desc: Get the number of elements in the stack instance. For example: stack.length. - */ - it("testLength011", 0, function () { - let stack = new Stack(); - stack.push(8); - stack.push("一"); - stack.push("二"); - stack.push(5); - let res = stack.length; - expect(4).assertEqual(res); - }); - - /** - * @tc.name: testLength012 - * @tc.desc: Get the number of elements in the stack instance. For example: stack.length. - */ - it("testLength012", 0, function () { - let stack = new Stack(); - let res = stack.length; - expect(0).assertEqual(res); - }); - - /** - * @tc.name: testIsEmpty013 - * @tc.desc: Determine whether the Stack instance is empty. For example: stack.isEmpty(). - */ - it("testIsEmpty013", 0, function () { - let stack = new Stack(); - stack.push(8); - stack.push("一"); - stack.push("二"); - stack.push(5); - let res = stack.isEmpty(); - expect(res).assertEqual(false); - }); - - /** - * @tc.name: testIsEmpty014 - * @tc.desc: Determine whether the Stack instance is empty. For example: stack.isEmpty(). - */ - it("testIsEmpty014", 0, function () { - let stack = new Stack(); - let res = stack.isEmpty(); - expect(res).assertEqual(true); - }); - - /** - * @tc.name: testPush015 - * @tc.desc: Insert element at top of stack.For example: stack.push("你好世界"). - */ - it("testPush015", 0, function () { - let stack = new Stack(); - stack.push("你好世界"); - let res = stack.peek(); - expect(res).assertEqual("你好世界"); - }); - - /** - * @tc.name: testPush016 - * @tc.desc: Insert element at top of stack.For example: stack.push(1234). - */ - it("testPush016", 0, function () { - let stack = new Stack(); - stack.push(1234); - let res = stack.peek(); - expect(res).assertEqual(1234); - }); - - /** - * @tc.name: testPush017 - * @tc.desc: Insert element at top of stack.For example: stack.push(1.234). - */ - it("testPush017", 0, function () { - let stack = new Stack(); - stack.push(1.234); - let res = stack.peek(); - expect(res).assertEqual(1.234); - }); - - /** - * @tc.name: testPush018 - * @tc.desc: Insert element at top of stack.For example: stack.push(-1234). - */ - it("testPush018", 0, function () { - let stack = new Stack(); - stack.push(-1234); - let res = stack.peek(); - expect(res).assertEqual(-1234); - }); - - /** - * @tc.name: testPush019 - * @tc.desc: Insert element at top of stack.For example: stack.push(0). - */ - it("testPush019", 0, function () { - let stack = new Stack(); - stack.push(0); - let res = stack.peek(); - expect(res).assertEqual(0); - }); - - /** - * @tc.name: testPush020 - * @tc.desc: Insert element at top of stack.For example: stack.push("*"). - */ - it("testPush020", 0, function () { - let stack = new Stack(); - stack.push(10); - stack.push(3.14); - stack.push(-2); - stack.push("AB"); - stack.push("*"); - let res = stack.peek(); - expect(res).assertEqual("*"); - }); - - /** - * @tc.name: testPush021 - * @tc.desc: Insert element at top of stack.For example: let arr = {}; stack.push(arr). - */ - it("testPush021", 0, function () { - let stack = new Stack(); - let arr = {}; - stack.push(arr); - let res = stack.peek(); - expect(res).assertEqual(arr); - }); - - /** - * @tc.name: testPush022 - * @tc.desc: Insert element at top of stack.For example: let arr = []; stack.push(arr). - */ - it("testPush022", 0, function () { - let stack = new Stack(); - let arr = []; - stack.push(arr); - let res = stack.peek(); - expect(res).assertEqual(arr); - }); - - /** - * @tc.name: testPush023 - * @tc.desc: Insert element at top of stack.For example: stack.push("hello world"). - */ - it("testPush023", 0, function () { - let stack = new Stack(); - stack.push("hello world"); - let res = stack.peek(); - expect(res).assertEqual("hello world"); - }); - - /** - * @tc.name: testPush024 - * @tc.desc: Insert element at top of stack. - */ - it("testPush024", 0, function () { - let stack = new Stack(); - stack.push("~!@#$^&*()_+-*/=.?<>:;|{}[]"); - let res = stack.peek(); - expect(res).assertEqual("~!@#$^&*()_+-*/=.?<>:;|{}[]"); - }); - - /** - * @tc.name: testPush025 - * @tc.desc: Insert element at top of stack. For example: stack.push(""). - */ - it("testPush025", 0, function () { - let stack = new Stack(); - stack.push(""); - let res = stack.peek(); - expect(res).assertEqual(""); - }); - - /** - * @tc.name: testPush026 - * @tc.desc: Insert element at top of stack. For example: stack.push(true). - */ - it("testPush026", 0, function () { - let stack = new Stack(); - stack.push(true); - let res = stack.peek(); - expect(res).assertEqual(true); - }); - - /** - * @tc.name: testPush027 - * @tc.desc: Insert element at top of stack. For example: stack.push(false). - */ - it("testPush027", 0, function () { - let stack = new Stack(); - stack.push(false); - let res = stack.peek(); - expect(res).assertEqual(false); - }); - - /** - * @tc.name: testPush028 - * @tc.desc: Insert element at top of stack. For example: stack.push(null). - */ - it("testPush028", 0, function () { - let stack = new Stack(); - stack.push(null); - let res = stack.peek(); - expect(res).assertEqual(null); - }); - - /** - * @tc.name: testPush029 - * @tc.desc: Insert element at top of stack. For example: stack.push(undefined). - */ - it("testPush029", 0, function () { - let stack = new Stack(); - stack.push(undefined); - let res = stack.peek(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.name: testPeek030 - * @tc.desc: Get stack top element. For example: stack.peek(). - */ - it("testPeek030", 0, function () { - let stack = new Stack(); - let res = stack.peek(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.name: testPop031 - * @tc.desc: Delete top of stack element. For example: stack.pop(). - */ - it("testPop031", 0, function () { - let stack = new Stack(); - let res = stack.pop(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.name: testForEach032 - * @tc.desc: Traversing elements in stack instances. For example: stack.forEach((item, index) => {arr.push(item);}). - */ - it("testForEach032", 0, function () { - let stack = new Stack(); - let arr = []; - stack.forEach((item, index) => { - arr.push(item); - }); - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.name: testIterator033 - * @tc.desc: Iterate over all elements in the stack instance. For example: for (let item of stack) {arr.push(item);}. - */ - it("testIterator033", 0, function () { - let stack = new Stack(); - let arr = []; - for (let item of stack) { - arr.push(item); - } - expect(arr.length).assertEqual(0); - }); - - /** - * @tc.name: testPush034 - * @tc.desc: Insert element at top of stack. For example: for (let i = 0; i < 1000; i++) {stack.push(i);}. - */ - it("testPush034", 0, function () { - let stack = new Stack(); - for (let i = 0; i < 1000; i++) { - stack.push(i); - } - let res = stack.length; - expect(res).assertEqual(1000); - let res1 = stack.peek(); - expect(res1).assertEqual(999); - }); - - /** - * @tc.name: testIterator035 - * @tc.desc: Iterate over all elements in the stack instance. For example: stack[Symbol.iterator](). - */ - it("testIterator035", 0, function () { - let stack = new Stack(); - stack.push(8); - stack.push("一"); - stack.push("二"); - stack.push(5); - let c = [1, 2, 3, 4]; - stack.push(c); - stack.push(6); - stack.push("三"); - stack.push("四"); - let arr = []; - let itr = stack[Symbol.iterator](); - let tmp = undefined; - do { - tmp = itr.next().value; - arr.push(tmp); - } while (tmp != undefined); - let a = [8, "一", "二", 5, c, 6, "三", "四"]; - for (let i = 0; i < a.length; i++) { - expect(arr[i]).assertEqual(a[i]); - } - }); - - /** - * @tc.name: testPush036 - * @tc.desc: Insert element at top of stack. For example: stack.push.bind({}, 10)(). - */ - it("testPush036 ", 0, function () { - let stack = new Stack(); - try { - stack.push.bind({}, 10)(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The push method cannot be bound`); - } - }); - - /** - * @tc.name: testIsEmpty037 - * @tc.desc: Determine whether the Stack instance is empty. For example: stack.isEmpty.bind({}, "a")(). - */ - it('testIsEmpty037', 0, function () { - let stack = new Stack(); - try { - stack.isEmpty.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The isEmpty method cannot be bound`); - } - }); - - /** - * @tc.name: testPop038 - * @tc.desc: Delete top of stack element. For example: stack.pop.bind({}, "a")(). - */ - it('testPop038', 0, function () { - let stack = new Stack(); - try { - stack.pop.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The pop method cannot be bound`); - } - }); -}); -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/module.json b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/module.json deleted file mode 100755 index 97abf299e24252ccc8b0b3464cb59dc60eeaca64..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarystacketstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/app.json deleted file mode 100755 index a19dfe3b130851688739f7e1ec9c1014f98d325c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.taskpool.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/element/string.json deleted file mode 100755 index c96ccdb143584bd27a7af38f3e3b5200c09d0d07..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/media/app_icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/BUILD.gn b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/BUILD.gn deleted file mode 100755 index b43c67b83a4bee53a70bd20f1a4f3f0a1234d25b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformCommonlibraryTaskpoolTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCrossplatformCommonlibraryTaskpoolTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - sources = [ "src/main/resources" ] - deps = [ ":windowStage_app_profile" ] - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/Test.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/Test.json deleted file mode 100755 index 4232055c259e49140ba1e7c097bbe310767c9546..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.taskpool.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformCommonlibraryTaskpoolTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/signature/openharmony_sx.p7b deleted file mode 100755 index 40ecbe805e5ef45105f9bba32665702065549588..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100755 index 34e37eb84f3033ea9f3be16336152223801e2e4a..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100755 index 82eb2048efc21bba6a4a61674d1e5ca2c3b8321b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100755 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/List.test.ets deleted file mode 100755 index 84952315be5ddfee55a42d9cbf5c700cd36d7973..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import TaskPoolTest from './Taskpool.test' - -export default function testsuite() { - TaskPoolTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/Taskpool.test.ets b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/Taskpool.test.ets deleted file mode 100755 index c5146b141f57caf5d593083303a6efc8378f8bca..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/ets/test/Taskpool.test.ets +++ /dev/null @@ -1,1772 +0,0 @@ -/* - * Copyright (c) 2023 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. - */ -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium' -import taskpool from '@ohos.taskpool' -import List from '@ohos.util.List' -export default function TaskPoolTest() { - describe('TaskPoolTest', function () { - // Defines a test suite. Two parameters are supported: test suite name and test suite function. - - function promiseCase() { - let p = new Promise(function (resolve, reject) { - setTimeout(function () { - resolve() - }, 100) - }).then(undefined, (error) => { - }) - return p - } - - /** - * @tc.number : TEST_TASK_CONSTRUCTOR_001 - * @tc.name : testTaskConstructor001 - * @tc.desc : Create a Task instance. For example: let task = new taskpool.Task(function, args). - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskConstructor001', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10,20); - var result = await taskpool.execute(task); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_CONSTRUCTOR_002 - * @tc.name : testTaskConstructor001 - * @tc.desc : Create a Task instance. For example: let task = new taskpool.Task(function, args). - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskConstructor002', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10); - var result = await taskpool.execute(task); - expect(result.toString()).assertEqual("NaN"); - done(); - }) - - /** - * @tc.number : TEST_TASK_CONSTRUCTOR_003 - * @tc.name : testTaskConstructor003 - * @tc.desc : Create a Task instance. For example: let task = new taskpool.Task(function, args). - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskConstructor003', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10,20,30); - var result = await taskpool.execute(task); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_SET_TRANSFER_LIST_001 - * @tc.name : testTaskSetTransferList001 - * @tc.desc : To test Task SetTransferLis - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskSetTransferList001', 0, async function (done) { - let buffer = new ArrayBuffer(8); - let view = new Uint8Array(buffer); - let buffer1 = new ArrayBuffer(16); - let view1 = new Uint8Array(buffer1); - - function testTransfer(arg1, arg2) { - "use concurrent" - return arg1.byteLength + arg2.byteLength; - } - let task = new taskpool.Task(testTransfer, view, view1); - task.setTransferList([view.buffer, view1.buffer]); - taskpool.execute(task).then((res)=>{ - expect(res).assertEqual(24); - }); - done(); - }) - - /** - * @tc.number : TEST_TASK_GROUP_CONSTRUCTOR_001 - * @tc.name : testTaskGroupConstructor001 - * @tc.desc : Create a TaskGroup instance - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskGroupConstructor001', 0, async function (done) { - try { - let taskgroup = new taskpool.TaskGroup(); - expect(taskgroup != undefined).assertEqual(true); - done(); - } catch (err) { - expect(err.name).assertEqual("TypeError"); - expect(err.code).assertEqual(undefined); - expect(err.message).assertEqual("Constructor is false"); - } - }) - - /** - * @tc.number : TEST_TASK_GROUP_ADD_TASK_001 - * @tc.name : testTaskGroupAddTask001 - * @tc.desc : To test TaskGroup function addTask - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskGroupAddTask001', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - let task1 = new taskpool.Task(Sum,10,20); - let task2 = new taskpool.Task(Sum,10,20); - let task3 = new taskpool.Task(Sum,10,20); - let taskgroup = new taskpool.TaskGroup(); - taskgroup.addTask(task1); - taskgroup.addTask(task2); - taskgroup.addTask(task3); - done(); - }) - - /** - * @tc.number : TEST_TASK_GROUP_ADD_TASK_002 - * @tc.name : testTaskGroupAddTask002 - * @tc.desc : To test TaskGroup function addTask - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskGroupAddTask002', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - let taskgroup = new taskpool.TaskGroup(); - taskgroup.addTask(Sum,10,20); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_001 - * @tc.name : testTaskPoolExecute001 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute001', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result = await taskpool.execute(Sum, 10, 20); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_002 - * @tc.name : testTaskPoolExecute002 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute002', 0, async function (done) { - function Add(value1, value2) { - "use concurrent" - if (value1 & value2) - return true; - else - return false; - } - var result = await taskpool.execute(Add, true, true); - expect(result).assertEqual(true); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_003 - * @tc.name : testTaskPoolExecute003 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute003', 0, async function (done) { - function StrCat(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result = await taskpool.execute(StrCat, "abc", "def"); - expect(result).assertEqual("abcdef"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_004 - * @tc.name : testTaskPoolExecute004 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute004', 0, async function (done) { - function StrCat(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result = await taskpool.execute(StrCat, "abc", "def"); - result = await taskpool.execute(StrCat, "abc", "def"); - expect(result).assertEqual("abcdef"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_005 - * @tc.name : testTaskPoolExecute002 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute005', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - function StrCat(value1, value2) { - return value1 + value2; - } - return value1+StrCat(value2,"hello"); - } - var result = await taskpool.execute(Sum, "abc", "def"); - expect(result).assertEqual("abcdefhello"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_006 - * @tc.name : testTaskPoolExecute006 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute006', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = []; - value[0] = arg1[0] + arg2[0]; - value[1] = arg1[1] + arg2[1]; - return value; - } - var result = await taskpool.execute(Sum, [1,2], [3,4]); - expect(result[0]).assertEqual(4); - expect(result[1]).assertEqual(6); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_007 - * @tc.name : testTaskPoolExecute007 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute007', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = arg1; - value.a = arg1.a + arg2.a; - value.b = arg1.b + arg2.b; - return value; - } - var result = await taskpool.execute(Sum, {"a": 1, "b" : 2}, {"a": 3, "b" : 4}); - expect(JSON.stringify(result)).assertEqual("{\"a\":4,\"b\":6}"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_008 - * @tc.name : testTaskPoolExecute008 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute008', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result = await taskpool.execute(Sum, 10); - expect(result.toString()).assertEqual("NaN"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_009 - * @tc.name : testTaskPoolExecute009 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute009', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result = await taskpool.execute(Sum, 10, 20, 30); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_010 - * @tc.name : testTaskPoolExecute010 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute010', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1 = await taskpool.execute(Sum, 10, 20); - var result2 = await taskpool.execute(Sum, 30, 40); - expect(result1).assertEqual(30); - expect(result2).assertEqual(70); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_011 - * @tc.name : testTaskPoolExecute011 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute011', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1 = await taskpool.execute(Sum, 10, 20); - var result2 = await taskpool.execute(Sum, 10, 20); - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_012 - * @tc.name : testTaskPoolExecute012 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute012', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - function Multi(value1, value2) { - "use concurrent" - return value1 * value2; - } - var result1 = await taskpool.execute(Sum, 10, 20); - var result2 = await taskpool.execute(Multi, 10, 20); - var result3 = await taskpool.execute(Sum, 10, 30); - var result4 = await taskpool.execute(Multi, 20, 20); - expect(result1).assertEqual(30); - expect(result2).assertEqual(200); - expect(result3).assertEqual(40); - expect(result4).assertEqual(400); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_013 - * @tc.name : testTaskPoolExecute013 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute013', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10, 20); - var result = await taskpool.execute(task); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_014 - * @tc.name : testTaskPoolExecute014 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute014', 0, async function (done) { - function Add(value1, value2) { - "use concurrent" - if (value1 & value2) - return true; - else - return false; - } - var task = new taskpool.Task(Add, true, true); - var result = await taskpool.execute(task); - expect(result).assertEqual(true); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_015 - * @tc.name : testTaskPoolExecute015 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute015', 0, async function (done) { - function StrCat(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(StrCat, "abc", "def"); - var result = await taskpool.execute(task); - expect(result).assertEqual("abcdef"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_016 - * @tc.name : testTaskPoolExecute016 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute016', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - function StrCat(value1, value2) { - return value1 + value2; - } - return value1+StrCat(value2,"hello"); - } - var task = new taskpool.Task(Sum, "abc", "def"); - var result = await taskpool.execute(task); - expect(result).assertEqual("abcdefhello"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_017 - * @tc.name : testTaskPoolExecute017 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute017', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = []; - value[0] = arg1[0] + arg2[0]; - value[1] = arg1[1] + arg2[1]; - return value; - } - var task = new taskpool.Task(Sum, [1,2], [3,4]); - var result = await taskpool.execute(task); - expect(result[0]).assertEqual(4); - expect(result[1]).assertEqual(6); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_018 - * @tc.name : testTaskPoolExecute018 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute018', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = arg1; - value.a = arg1.a + arg2.a; - value.b = arg1.b + arg2.b; - return value; - } - var task = new taskpool.Task(Sum, {"a": 1, "b" : 2}, {"a": 3, "b" : 4}); - var result = await taskpool.execute(task); - expect(JSON.stringify(result)).assertEqual("{\"a\":4,\"b\":6}"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_019 - * @tc.name : testTaskPoolExecute019 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute019', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10); - var result = await taskpool.execute(task); - expect(result.toString()).assertEqual("NaN"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_020 - * @tc.name : testTaskPoolExecute020 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute020', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10, 20, 30); - var result = await taskpool.execute(task); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_021 - * @tc.name : testTaskPoolExecute021 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute021', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10, 20); - var result1 = await taskpool.execute(task); - var result2 = await taskpool.execute(task); - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_022 - * @tc.name : testTaskPoolExecute022 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute022', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task1 = new taskpool.Task(Sum, 10, 20); - var task2 = new taskpool.Task(Sum, 30, 40); - var result1 = await taskpool.execute(task1); - var result2 = await taskpool.execute(task2); - expect(result1).assertEqual(30); - expect(result2).assertEqual(70); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_023 - * @tc.name : testTaskPoolExecute023 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute023', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task1 = new taskpool.Task(Sum, 10, 20); - var task2 = new taskpool.Task(Sum, 10, 20); - var result1 = await taskpool.execute(task1); - var result2 = await taskpool.execute(task2); - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_024 - * @tc.name : testTaskPoolExecute024 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute024', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - function Multi(value1, value2) { - "use concurrent" - return value1 * value2; - } - var task1 = new taskpool.Task(Sum, 10, 20); - var result1 = await taskpool.execute(task1); - var task2 = new taskpool.Task(Multi, 10, 20); - var result2 = await taskpool.execute(task2); - var task3 = new taskpool.Task(Sum, 10, 30); - var result3 = await taskpool.execute(task3); - var task4 = new taskpool.Task(Multi, 20, 20); - var result4 = await taskpool.execute(task4); - expect(result1).assertEqual(30); - expect(result2).assertEqual(200); - expect(result3).assertEqual(40); - expect(result4).assertEqual(400); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_025 - * @tc.name : testTaskPoolExecute025 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute025', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result; - var isTerminate = false; - var task = new taskpool.Task(Sum, 10, 20) - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_026 - * @tc.name : testTaskPoolExecute026 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute026', 0, async function (done) { - function Add(value1, value2) { - "use concurrent" - if (value1 & value2) - return true; - else - return false; - } - var task = new taskpool.Task(Add, true, true) - var isTerminate = false; - var result; - taskpool.execute(task).then((ret) => { - isTerminate = true; - result = ret; - }); - - while (!isTerminate) { - await promiseCase(); - } - - expect(result).assertEqual(true); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_027 - * @tc.name : testTaskPoolExecute027 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute027', 0, async function (done) { - function StrCat(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(StrCat, "abc", "def") - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual("abcdef"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_028 - * @tc.name : testTaskPoolExecute028 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute028', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - function StrCat(value1, value2) { - return value1 + value2; - } - return value1+StrCat(value2,"hello"); - } - var task = new taskpool.Task(Sum, "abc", "def"); - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual("abcdefhello"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_029 - * @tc.name : testTaskPoolExecute029 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute029', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = []; - value[0] = arg1[0] + arg2[0]; - value[1] = arg1[1] + arg2[1]; - return value; - } - var task = new taskpool.Task(Sum, [1,2], [3,4]); - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result[0]).assertEqual(4); - expect(result[1]).assertEqual(6); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_030 - * @tc.name : testTaskPoolExecute030 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute030', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = arg1; - value.a = arg1.a + arg2.a; - value.b = arg1.b + arg2.b; - return value; - } - var task = new taskpool.Task(Sum, {"a": 1, "b" : 2}, {"a": 3, "b" : 4}); - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(JSON.stringify(result)).assertEqual("{\"a\":4,\"b\":6}"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_031 - * @tc.name : testTaskPoolExecute031 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('TaskPoolTestClass031', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10); - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result.toString()).assertEqual("NaN"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_032 - * @tc.name : testTaskPoolExecute032 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute032', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task = new taskpool.Task(Sum, 10, 20, 30); - var result; - var isTerminate = false; - taskpool.execute(task).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_033 - * @tc.name : testTaskPoolExecute033 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute033', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1; - var result2; - var isTerminate1 = false; - var isTerminate2 = false; - - var task1 = new taskpool.Task(Sum, 10, 20); - taskpool.execute(task1).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - - var task2 = new taskpool.Task(Sum, 30, 40); - taskpool.execute(task2).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - while (!isTerminate1 || !isTerminate2) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(70); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_034 - * @tc.name : testTaskPoolExecute034 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute034', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1; - var result2; - var isTerminate1 = false; - var isTerminate2 = false; - - var task1 = new taskpool.Task(Sum, 10, 20) - taskpool.execute(task1).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - var task2 = new taskpool.Task(Sum, 10, 20) - taskpool.execute(task2).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - while (!isTerminate1 || !isTerminate2) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_035 - * @tc.name : testTaskPoolExecute035 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute035', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1; - var result2; - var isTerminate1 = false; - var isTerminate2 = false; - - var task = new taskpool.Task(Sum, 10, 20) - taskpool.execute(task).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - taskpool.execute(task).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - while (!isTerminate1 || !isTerminate2) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_036 - * @tc.name : testTaskPoolExecute036 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute036', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - function Multi(value1, value2) { - "use concurrent" - return value1 * value2; - } - - var result1; - var result2; - var result3; - var result4; - var isTerminate1 = false; - var isTerminate2 = false; - var isTerminate3 = false; - var isTerminate4 = false; - - var task1 = new taskpool.Task(Sum, 10, 20) - taskpool.execute(task1).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - var task2 = new taskpool.Task(Multi, 10, 20) - taskpool.execute(task2).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - var task3 = new taskpool.Task(Sum, 10, 30) - taskpool.execute(task3).then((ret3) => { - result3 = ret3; - isTerminate3 = true; - }) - var task4 = new taskpool.Task(Multi, 20, 20) - taskpool.execute(task4).then((ret4) => { - result4 = ret4; - isTerminate4 = true; - }) - - while (!isTerminate1 || !isTerminate2 || !isTerminate3 || !isTerminate4) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(200); - expect(result3).assertEqual(40); - expect(result4).assertEqual(400); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_037 - * @tc.name : testTaskPoolExecute037 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute037', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result; - var isTerminate = false; - taskpool.execute(Sum, 10, 20).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_038 - * @tc.name : testTaskPoolExecute038 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute038', 0, async function (done) { - function Add(value1, value2) { - "use concurrent" - if (value1 & value2) - return true; - else - return false; - } - var result; - var isTerminate = false; - taskpool.execute(Add, true, false).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual(false); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_039 - * @tc.name : testTaskPoolExecute039 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute039', 0, async function (done) { - function StrCat(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result; - var isTerminate = false; - taskpool.execute(StrCat, "abc", "def").then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual("abcdef"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_040 - * @tc.name : testTaskPoolExecute040 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute040', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - function StrCat(value1, value2) { - return value1 + value2; - } - return value1+StrCat(value2,"hello"); - } - var result; - var isTerminate = false; - taskpool.execute(Sum, "abc", "def").then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual("abcdefhello"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_041 - * @tc.name : testTaskPoolExecute041 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute041', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = []; - value[0] = arg1[0] + arg2[0]; - value[1] = arg1[1] + arg2[1]; - return value; - } - var result; - var isTerminate = false; - taskpool.execute(Sum, [1,2], [3,4]).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result[0]).assertEqual(4); - expect(result[1]).assertEqual(6); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_042 - * @tc.name : testTaskPoolExecute042 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute042', 0, async function (done) { - function Sum(arg1, arg2) { - "use concurrent" - let value = arg1; - value.a = arg1.a + arg2.a; - value.b = arg1.b + arg2.b; - return value; - } - var result; - var isTerminate = false; - taskpool.execute(Sum, {"a": 1, "b" : 2}, {"a": 3, "b" : 4}).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(JSON.stringify(result)).assertEqual("{\"a\":4,\"b\":6}"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_043 - * @tc.name : testTaskPoolExecute043 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute043', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result; - var isTerminate = false; - taskpool.execute(Sum, 10).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result.toString()).assertEqual("NaN"); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_044 - * @tc.name : testTaskPoolExecute044 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute044', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result; - var isTerminate = false; - taskpool.execute(Sum, 10, 20, 30).then((ret) => { - result = ret; - isTerminate = true; - }) - while (!isTerminate) { - await promiseCase() - } - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_045 - * @tc.name : testTaskPoolExecute045 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute045', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1; - var result2; - var isTerminate1 = false; - var isTerminate2 = false; - - taskpool.execute(Sum, 10, 20).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - taskpool.execute(Sum, 30, 40).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - while (!isTerminate1 || !isTerminate2) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(70); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_046 - * @tc.name : testTaskPoolExecute046 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute046', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var result1; - var result2; - var isTerminate1 = false; - var isTerminate2 = false; - - taskpool.execute(Sum, 10, 20).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - taskpool.execute(Sum, 10, 20).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - while (!isTerminate1 || !isTerminate2) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_047 - * @tc.name : testTaskPoolExecute047 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute047', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - function Multi(value1, value2) { - "use concurrent" - return value1 * value2; - } - - var result1; - var result2; - var result3; - var result4; - var isTerminate1 = false; - var isTerminate2 = false; - var isTerminate3 = false; - var isTerminate4 = false; - - taskpool.execute(Sum, 10, 20).then((ret1) => { - result1 = ret1; - isTerminate1 = true; - }) - taskpool.execute(Multi, 10, 20).then((ret2) => { - result2 = ret2; - isTerminate2 = true; - }) - taskpool.execute(Sum, 10, 30).then((ret3) => { - result3 = ret3; - isTerminate3 = true; - }) - taskpool.execute(Multi, 20, 20).then((ret4) => { - result4 = ret4; - isTerminate4 = true; - }) - while (!isTerminate1 || !isTerminate2 || !isTerminate3 || !isTerminate4) { - await promiseCase() - } - expect(result1).assertEqual(30); - expect(result2).assertEqual(200); - expect(result3).assertEqual(40); - expect(result4).assertEqual(400); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_048 - * @tc.name : testTaskPoolExecute048 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute048', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - try { - var result = await taskpool.execute(Sum); - } catch(e) { - expect(e.toString()).assertEqual("BusinessError: taskpool:: first param must be object when argc is one"); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_049 - * @tc.name : testTaskPoolExecute049 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute049', 0, async function (done) { - function Sum(value1, value2) { - "use concurrent" - return value1 + value2; - } - var task1 = new taskpool.Task(Sum, 10, 20); - var task2 = new taskpool.Task(Sum, 30, 40); - var task3 = new taskpool.Task(Sum, 50, 60); - var result1 = await taskpool.execute(task1,taskpool.Priority.LOW); - var result2 = await taskpool.execute(task2,taskpool.Priority.HIGH); - var result3 = await taskpool.execute(task3,taskpool.Priority.MEDIUM); - expect(result1).assertEqual(30); - expect(result2).assertEqual(70); - expect(result3).assertEqual(110); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_050 - * @tc.name : testTaskPoolExecute050 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute050', 0, async function (done) { - async function func(value1, value2) { - "use concurrent" - let result = await new Promise((resolve, reject) => { - let value = value1 + value2; - resolve(value); - }) - return result; - } - var result = await taskpool.execute(func, 10, 20); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_EXECUTE_051 - * @tc.name : testTaskPoolExecute051 - * @tc.desc : Place the pending function into the taskpool internal task queue and wait for the thread to execute. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolExecute051', 0, async function (done) { - async function func(value1, value2) { - "use concurrent" - let result = await new Promise((resolve, reject) => { - let value = value1 + value2; - resolve(value); - }) - return result; - } - var task = new taskpool.Task(func, 10, 20); - var result = await taskpool.execute(task); - expect(result).assertEqual(30); - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_001 - * @tc.name : testTaskPoolCancel001 - * @tc.desc : Cancel tasks that have not been executed - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel001', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - function additionDelay(arg) { - "use concurrent" - var start = new Date().getTime(); - while (new Date().getTime() - start < 200) { - continue; - } - return arg + 1; - } - try { - var task1 = new taskpool.Task(additionDelay, 100); - var task2 = new taskpool.Task(additionDelay, 200); - var task3 = new taskpool.Task(additionDelay, 200); - var task4 = new taskpool.Task(additionDelay, 200); - var task5 = new taskpool.Task(additionDelay, 200); - var task6 = new taskpool.Task(additionDelay, 200); - var task7 = new taskpool.Task(additionDelay, 200); - var task8 = new taskpool.Task(additionDelay, 200); - var task9 = new taskpool.Task(additionDelay, 200); - var task10 = new taskpool.Task(additionDelay, 200); - var task11 = new taskpool.Task(addition, 300); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - var result3 = taskpool.execute(task3); - var result4 = taskpool.execute(task4); - var result5 = taskpool.execute(task5); - var result6 = taskpool.execute(task6); - var result7 = taskpool.execute(task7); - var result8 = taskpool.execute(task8); - var result9 = taskpool.execute(task9); - var result10 = taskpool.execute(task10); - var result11 = taskpool.execute(task11); - - var start = new Date().getTime(); - while (new Date().getTime() - start < 20) { - continue; - } - - taskpool.cancel(task11); - } - catch (e) { - expect(e.toString()).assertEqual(""); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_002 - * @tc.name : testTaskPoolCancel002 - * @tc.desc : Cancel the task in progress - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel002', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - function additionDelay(arg) { - "use concurrent" - var start = new Date().getTime(); - while (new Date().getTime() - start < 3000) { - continue; - } - return arg + 1; - } - try { - var task1 = new taskpool.Task(additionDelay, 100); - var task2 = new taskpool.Task(additionDelay, 200); - var task3 = new taskpool.Task(addition, 300); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - var result3 = taskpool.execute(task3); - - var start = new Date().getTime(); - while (new Date().getTime() - start < 1000) { - continue; - } - - taskpool.cancel(task1); - } - catch (e) { - expect(e.toString()).assertEqual( - "BusinessError: The task is executing when it is canceled, taskpool:: can not cancel the running task"); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_003 - * @tc.name : testTaskPoolCancel003 - * @tc.desc : Cancel the executed task - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel003', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - try { - var task1 = new taskpool.Task(addition, 100); - var task2 = new taskpool.Task(addition, 200); - var task3 = new taskpool.Task(addition, 300); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - var result3 = taskpool.execute(task3); - - var start = new Date().getTime(); - while (new Date().getTime() - start < 1000) { - continue; - } - - taskpool.cancel(task1); - } - catch (e) { - expect(e.toString()).assertEqual( - "BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task"); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_004 - * @tc.name : testTaskPoolCancel004 - * @tc.desc : Cancel nonexistent task - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel004', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - try { - var task1 = new taskpool.Task(addition, 100); - var task2 = new taskpool.Task(addition, 200); - var task3 = new taskpool.Task(addition, 300); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - - taskpool.cancel(task3); - } - catch (e) { - expect(e.toString()).assertEqual( - "BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task"); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_005 - * @tc.name : testTaskPoolCancel005 - * @tc.desc : Canceling unexecuted tasks multiple times - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel005', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - function additionDelay(arg) { - "use concurrent" - var start = new Date().getTime(); - while (new Date().getTime() - start < 3000) { - continue; - } - return arg + 1; - } - try { - var task1 = new taskpool.Task(additionDelay, 100); - var task2 = new taskpool.Task(additionDelay, 200); - var task3 = new taskpool.Task(addition, 300); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - var result3 = taskpool.execute(task3); - - var start = new Date().getTime(); - while (new Date().getTime() - start < 1000) { - continue; - } - - taskpool.cancel(task3); - taskpool.cancel(task3); - } - catch (e) { - expect(e.toString()).assertEqual( - "BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task"); - } - done(); - }) - - /** - * @tc.number : TEST_TASK_POOL_Cancel_006 - * @tc.name : testTaskPoolCancel006 - * @tc.desc : Cancel all tasks in sequence - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 2 - */ - it('testTaskPoolCancel006', 0, async function (done) { - function addition(arg) { - "use concurrent" - return arg + 1; - } - try { - var task1 = new taskpool.Task(addition, 100); - var task2 = new taskpool.Task(addition, 200); - var task3 = new taskpool.Task(addition, 300); - var task4 = new taskpool.Task(addition, 400); - var task5 = new taskpool.Task(addition, 500); - var task6 = new taskpool.Task(addition, 600); - - var result1 = taskpool.execute(task1); - var result2 = taskpool.execute(task2); - var result3 = taskpool.execute(task3); - var result4 = taskpool.execute(task4); - var result5 = taskpool.execute(task5); - var result6 = taskpool.execute(task6); - - var start = new Date().getTime(); - while (new Date().getTime() - start < 100) { - continue; - } - - taskpool.cancel(task6); - taskpool.cancel(task5); - taskpool.cancel(task4); - taskpool.cancel(task3); - taskpool.cancel(task2); - } - catch (e) { - expect(e.toString()).assertEqual( - "BusinessError: The task does not exist when it is canceled, taskpool:: can not find the task"); - } - done(); - }) - }) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/module.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/module.json deleted file mode 100755 index 97abf299e24252ccc8b0b3464cb59dc60eeaca64..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/color.json deleted file mode 100755 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/string.json deleted file mode 100755 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/media/icon.png deleted file mode 100755 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/profile/test_pages.json deleted file mode 100755 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytaskpooletstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/app.json deleted file mode 100644 index 727cacacae9d5f6319906e114ecd2a3fe17d717e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.treeset.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytreesetetstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/BUILD.gn b/commonlibrary/crossplatform/commonlibrarytreesetetstest/BUILD.gn deleted file mode 100644 index 4b892be28bba458de2eb65eb2a26e243638ae4bf..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformTreeSetTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformTreeSetTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/Test.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/Test.json deleted file mode 100644 index 6fbffe1831578c509e44d556e2f8001d4b0b8ed7..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.treeset.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformTreeSetTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibrarytreesetetstest/signature/openharmony_sx.p7b deleted file mode 100644 index 14549e4f1159287c9a8843b16b3fdc105d365940..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytreesetetstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 842f36f8e60950a32e4b8724f3b37bf0be12f725..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import TreeSetTest from './TreeSet.test' - -export default function testsuite() { - TreeSetTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/TreeSet.test.ets b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/TreeSet.test.ets deleted file mode 100644 index cfd41b0e5746332f5a01d7f0f314297239e7ea39..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/ets/test/TreeSet.test.ets +++ /dev/null @@ -1,780 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import TreeSet from "@ohos.util.TreeSet"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' -export default function TreeSetTest() { -describe("TreeSetTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let treeSet = new TreeSet(); - expect(treeSet != undefined).assertTrue(); - }); - - /** - * @tc.number: TEST_LENGTH_001 - * @tc.name : testLength001 - * @tc.desc : Get the number of element in the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 0 - */ - it("testLength001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - let res = treeSet.length; - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_IS_EMPTY_001 - * @tc.name : testIsEmpty001 - * @tc.desc : Determine whether the TreeSet instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - let res1 = treeSet.isEmpty(); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EMPTY_002 - * @tc.name : testIsEmpty002 - * @tc.desc : Determine whether the TreeSet instance is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmpty002", 0, function () { - let treeSet = new TreeSet(); - let res2 = treeSet.isEmpty(); - expect(res2).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_001 - * @tc.name : testHas001 - * @tc.desc : Determine whether the TreeSet instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - let res = treeSet.has(2); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_HAS_002 - * @tc.name : testHas002 - * @tc.desc : Determine whether the TreeSet instance contains the specified element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testHas002", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - let res1 = treeSet.has(3); - expect(res1).assertEqual(false); - }); - - /** - * @tc.number: TEST_ADD_001 - * @tc.name : testAdd001 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("四"); - let res = treeSet.has("四"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_002 - * @tc.name : testAdd002 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd002", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(8); - let res = treeSet.has(8); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_003 - * @tc.name : testAdd003 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd003", 0, function () { - let treeSet = new TreeSet(); - let a = [1, 2, 3, 4]; - treeSet.add(a); - let res = treeSet.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_004 - * @tc.name : testAdd004 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd004", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("*"); - let res = treeSet.has("*"); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_005 - * @tc.name : testAdd005 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd005", 0, function () { - let treeSet = new TreeSet(); - let a = {name: "lala", age: "13岁"}; - treeSet.add(a); - let res = treeSet.has(a); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_006 - * @tc.name : testAdd006 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd006", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(1.234); - let res = treeSet.has(1.234); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_007 - * @tc.name : testAdd007 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd007", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(true); - let res = treeSet.has(true); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_008 - * @tc.name : testAdd008 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd008", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(""); - let res = treeSet.has(""); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_009 - * @tc.name : testAdd009 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd009", 0, function () { - let treeSet = new TreeSet(); - for (let i = 0; i < 10000; i++) { - treeSet.add(i); - } - let res = treeSet.has(8888); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_ADD_010 - * @tc.name : testAdd010 - * @tc.desc : Add element to TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAdd010", 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.add.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The add method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_REMOVE_001 - * @tc.name : testRemove001 - * @tc.desc : Delete the specified value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - treeSet.add("b"); - treeSet.add("c"); - treeSet.add("c"); - treeSet.add("d"); - treeSet.add("g"); - let res1 = treeSet.remove("c"); - expect(res1).assertEqual(true); - let res2 = treeSet.has("c"); - expect(res2).assertEqual(false); - }); - - /** - * @tc.number: TEST_REMOVE_002 - * @tc.name : testRemove002 - * @tc.desc : Delete the specified value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRemove002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.remove("c"); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_CLEAR_001 - * @tc.name : testClear001 - * @tc.desc : Clear all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.clear(); - let res = treeSet.length; - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_CLEAR_002 - * @tc.name : testClear002 - * @tc.desc : Clear all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClear002", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.clear(); - let res = treeSet.length; - expect(res).assertEqual(0); - let res1 = treeSet.popFirst(); - expect(res1).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_CLEAR_003 - * @tc.name : testClear003 - * @tc.desc : Clear all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testClear003', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.clear.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The clear method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_GET_FIRST_VALUE_001 - * @tc.name : testGetFirstValue001 - * @tc.desc : Get the value that ranks first in the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirstValue001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.add(3); - treeSet.add(4); - let res = treeSet.getFirstValue(); - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_GET_FIRST_VALUE_002 - * @tc.name : testGetFirstValue002 - * @tc.desc : Get the value that ranks first in the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetFirstValue002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.getFirstValue(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_LAST_VALUE_001 - * @tc.name : testGetLastValue001 - * @tc.desc : Get the last sorted key in the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastValue001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - let res = treeSet.getLastValue(); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_GET_LAST_VALUE_002 - * @tc.name : testGetLastValue002 - * @tc.desc : Get the last sorted key in the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLastValue002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.getLastValue(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_LOWER_VALUE_001 - * @tc.name : testGetLowerValue001 - * @tc.desc : Get a value that is a little lower than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLowerValue001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.add(3); - treeSet.add(4); - let res = treeSet.getLowerValue(2); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_LOWER_VALUE_002 - * @tc.name : testGetLowerValue002 - * @tc.desc : Get a value that is a little lower than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLowerValue002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.getLowerValue(2); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_LOWER_VALUE_003 - * @tc.name : testGetLowerValue003 - * @tc.desc : Get a value that is a little lower than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testGetLowerValue003', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.getLowerValue.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The getLowerValue method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_GET_LOWER_VALUE_004 - * @tc.name : testGetLowerValue004 - * @tc.desc : Get a value that is a little lower than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testGetLowerValue004', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.getLowerValue(null); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "key" must be not null. Received value is: null`); - } - }); - - /** - * @tc.number: TEST_GET_HIGHER_VALUE_001 - * @tc.name : testGetHigherValue001 - * @tc.desc : Get a value that is a little higher than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetHigherValue001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.add(3); - treeSet.add(4); - let res = treeSet.getHigherValue(3); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_GET_HIGHER_VALUE_002 - * @tc.name : testGetHigherValue002 - * @tc.desc : Get a value that is a little higher than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetHigherValue002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.getHigherValue(3); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_GET_HIGHER_VALUE_003 - * @tc.name : testGetHigherValue003 - * @tc.desc : Get a value that is a little higher than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testGetHigherValue003', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.getHigherValue(null); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`The type of "key" must be not null. Received value is: null`); - } - }); - - /** - * @tc.number: TEST_GET_HIGHER_VALUE_004 - * @tc.name : testGetHigherValue004 - * @tc.desc : Get a value that is a little higher than the specified value sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testGetHigherValue004', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.getHigherValue.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The getHigherValue method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_POP_FIRST_001 - * @tc.name : testPopFirst001 - * @tc.desc : Delete first value of sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopFirst001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - treeSet.add("b"); - treeSet.add("c"); - treeSet.add("d"); - treeSet.add("e"); - let res = treeSet.popFirst(); - expect(res).assertEqual("a"); - }); - - /** - * @tc.number: TEST_POP_FIRST_002 - * @tc.name : testPopFirst002 - * @tc.desc : Delete first value of sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopFirst002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.popFirst(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_POP_LAST_001 - * @tc.name : testPopLast001 - * @tc.desc : Delete last value of sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopLast001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - treeSet.add("b"); - treeSet.add("c"); - treeSet.add("d"); - treeSet.add("e"); - let res = treeSet.popLast(); - expect(res).assertEqual("e"); - }); - - /** - * @tc.number: TEST_POP_LAST_002 - * @tc.name : testPopLast002 - * @tc.desc : Delete last value of sort. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testPopLast002", 0, function () { - let treeSet = new TreeSet(); - let res = treeSet.popLast(); - expect(res).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_FOR_EACH_001 - * @tc.name : testForEach001 - * @tc.desc : Traverse the collection of all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testForEach001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.add(3); - treeSet.add(4); - let arr1 = []; - treeSet.forEach((value, key) => { - arr1.push(value); - }); - let arr = [0, 1, 2, 3, 4]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); - - /** - * @tc.number: TEST_FOR_EACH_002 - * @tc.name : testForEach002 - * @tc.desc : Traverse the collection of all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testForEach002', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.forEach.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The forEach method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_VALUES_001 - * @tc.name : testValues001 - * @tc.desc : Get a collection of all the values in the TreeSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testValues001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - treeSet.add("b"); - treeSet.add("c"); - treeSet.add("d"); - treeSet.add("g"); - let res = treeSet.values(); - expect(res.next().value).assertEqual("a"); - expect(res.next().value).assertEqual("b"); - expect(res.next().value).assertEqual("c"); - expect(res.next().value).assertEqual("d"); - expect(res.next().value).assertEqual("g"); - }); - - /** - * @tc.number: TEST_VALUES_002 - * @tc.name : testValues002 - * @tc.desc : Get a collection of all the values in the TreeSet. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it('testValues002', 0, function () { - let treeSet = new TreeSet(); - try { - treeSet.values.bind({}, "a")(); - expect(true).assertEqual(false); - } catch (err) { - expect(err.name).assertEqual("BusinessError"); - expect(err.code).assertEqual(10200011); - expect(err.message).assertEqual(`The Symbol.iterator method cannot be bound`); - } - }); - - /** - * @tc.number: TEST_ENTRIES_001 - * @tc.name : testEntries001 - * @tc.desc : Get all key value pairs collection in TreeMap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEntries001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add("a"); - treeSet.add("b"); - treeSet.add("c"); - treeSet.add("d"); - treeSet.add("g"); - let res = treeSet.entries(); - expect(JSON.stringify(res.next().value)).assertEqual('["a","a"]'); - expect(JSON.stringify(res.next().value)).assertEqual('["b","b"]'); - expect(JSON.stringify(res.next().value)).assertEqual('["c","c"]'); - expect(JSON.stringify(res.next().value)).assertEqual('["d","d"]'); - expect(JSON.stringify(res.next().value)).assertEqual('["g","g"]'); - }); - - /** - * @tc.number: TEST_ITERATOR_001 - * @tc.name : testIterator001 - * @tc.desc : Iterate over all elements of the TreeSet instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIterator001", 0, function () { - let treeSet = new TreeSet(); - treeSet.add(0); - treeSet.add(1); - treeSet.add(2); - treeSet.add(3); - treeSet.add(4); - let arr = []; - let res = treeSet[Symbol.iterator](); - let temp = undefined; - do { - temp = res.next().value; - arr.push(temp); - } while (temp != undefined); - let arr1 = [0, 1, 2, 3, 4]; - for (let i = 0; i < arr1.length; i++) { - expect(arr[i]).assertEqual(arr1[i]); - } - }); -}) -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/module.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibrarytreesetetstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/app.json deleted file mode 100644 index 3089b7cfd82ca8a40317667d3bf35bbdf15c2d06..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.uri.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurietstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryurietstest/BUILD.gn deleted file mode 100644 index 13a9a7652b2c53ab7de055ce4ab1048986bbb608..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformUriTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformUriTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/Test.json b/commonlibrary/crossplatform/commonlibraryurietstest/Test.json deleted file mode 100644 index 97823040975232e12f4eacecd36a360e0cb0e78c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.uri.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformUriTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryurietstest/signature/openharmony_sx.p7b deleted file mode 100644 index 332467c125a3da3e077caacf604cb59d0aea3467..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurietstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/List.test.ets deleted file mode 100644 index ba3f09189a48592954547025a5305f8a68f12a19..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import {UriTest} from './uri.test' - -export default function testsuite() { - UriTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/uri.test.ets b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/uri.test.ets deleted file mode 100644 index 8b8e23a7806bc015f0efa3398df871913de0c8ef..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/ets/test/uri.test.ets +++ /dev/null @@ -1,521 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ - -import uri from "@ohos.uri"; -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -export function UriTest() { - describe("UriTest", function () { - /** - * @tc.number: TEST_URI_CONSTRUCTION_001 - * @tc.name : testUriConstruction001 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction001", 0, function () { - try { - let that = new uri.URI("#http://username:password@host:8080/directory/file?foo=1&bar=2"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_002 - * @tc.name : testUriConstruction002 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction002", 0, function () { - try { - let that = new uri.URI("ht/tp://username:pas sword@host:8080/directory/file?foo=1&bar=2"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_003 - * @tc.name : testUriConstruction003 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction003", 0, function () { - try { - let that = new uri.URI("http://username:password@[::]:8080/directory/file?Query#gaogao faofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_004 - * @tc.name : testUriConstruction004 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction004", 0, function () { - try { - let that = new uri.URI("http://username:password@host:8080/directory/file?foo^=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_005 - * @tc.name : testUriConstruction005 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction005", 0, function () { - try { - let that = new uri.URI("1http://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_006 - * @tc.name : testUriConstruction006 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction006", 0, function () { - try { - let that = new uri.URI("ht@tp://username:password@host:8080/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_007 - * @tc.name : testUriConstruction007 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction007", 0, function () { - try { - let that = new uri.URI("http://username:password@[::]:80r80/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_008 - * @tc.name : testUriConstruction008 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction008", 0, function () { - try { - let that = new uri.URI("http://username:password@[::12:55:8080/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_009 - * @tc.name : testUriConstruction009 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction009", 0, function () { - try { - let that = new uri.URI("http://username:pa^ssword@[::12:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_010 - * @tc.name : testUriConstruction010 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction010", 0, function () { - try { - let that = new uri.URI("http://username:password@[::1你2:55]:8080/directory/file?foo=1&bar=2#gaogaofaofao"); - expect(false).assertEqual(true); - } catch (err) { - expect(err.toString()).assertEqual("BusinessError: Syntax Error. Invalid Uri string"); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual("Syntax Error. Invalid Uri string"); - } - }); - - /** - * @tc.number: TEST_URI_CONSTRUCTION_011 - * @tc.name : testUriConstruction011 - * @tc.desc : Constructs a URI by parsing the given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUriConstruction011", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@www.baidu.com:99/path/path?query#fagment"); - expect(gaogao.scheme).assertEqual("http"); - expect(gaogao.authority).assertEqual("gg:gaogao@www.baidu.com:99"); - expect(gaogao.ssp).assertEqual("//gg:gaogao@www.baidu.com:99/path/path?query"); - expect(gaogao.userInfo).assertEqual("gg:gaogao"); - expect(gaogao.host).assertEqual("www.baidu.com"); - expect(gaogao.port).assertEqual("99"); - expect(gaogao.path).assertEqual("/path/path"); - expect(gaogao.query).assertEqual("query"); - expect(gaogao.fragment).assertEqual("fagment"); - }); - - /** - * @tc.number: TEST_EQUALS_TO_001 - * @tc.name : testEqualsTo001 - * @tc.desc : Tests this URI for equality with another object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqualsTo001", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment"); - let gaogao1 = gaogao; - let res = gaogao.equalsTo(gaogao1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUALS_TO_002 - * @tc.name : testEqualsTo002 - * @tc.desc : Tests this URI for equality with another object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqualsTo002", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment"); - let gaogao1 = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment"); - let res = gaogao.equalsTo(gaogao1); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUALS_TO_003 - * @tc.name : testEqualsTo003 - * @tc.desc : Tests this URI for equality with another object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqualsTo003", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment"); - let gaogao1 = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123"); - let res = gaogao.equalsTo(gaogao1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUALS_TO_004 - * @tc.name : testEqualsTo004 - * @tc.desc : Tests this URI for equality with another object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqualsTo004", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@wwwaaa:99/path1?query#fagment"); - let gaogao1 = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment123"); - let res = gaogao.equalsTo(gaogao1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUALS_TO_005 - * @tc.name : testEqualsTo005 - * @tc.desc : Tests this URI for equality with another object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEqualsTo005", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path1?query#fagment"); - let gaogao1 = new uri.URI("http://[1:0:0:1:2:1:2:1]/path1?query#fagment123"); - let res = gaogao.equalsTo(gaogao1); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_NORMALIZE_001 - * @tc.name : testNormalize001 - * @tc.desc : Normalizes this URI's path. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testNormalize001", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/66./../././mm/.././path1?query#fagment"); - let res = gaogao.normalize(); - expect(res.path).assertEqual("/path/path1"); - expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/path1?query#fagment"); - }); - - /** - * @tc.number: TEST_NORMALIZE_002 - * @tc.name : testNormalize002 - * @tc.desc : Normalizes this URI's path. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testNormalize002", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment"); - let res = gaogao.normalize(); - expect(res.path).assertEqual("/../../path"); - expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path?query#fagment"); - }); - - /** - * @tc.number: TEST_NORMALIZE_003 - * @tc.name : testNormalize003 - * @tc.desc : Normalizes this URI's path. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testNormalize003", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment"); - let res = gaogao.normalize(); - expect(res.path).assertEqual("/../../../aa/bb/cc"); - expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../../aa/bb/cc?query#fagment"); - }); - - /** - * @tc.number: TEST_NORMALIZE_004 - * @tc.name : testNormalize004 - * @tc.desc : Normalizes this URI's path. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testNormalize004", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../path/.././../aa/bb/cc?query"); - let res = gaogao.normalize(); - expect(res.path).assertEqual("/../../aa/bb/cc"); - expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../aa/bb/cc?query"); - }); - - /** - * @tc.number: TEST_NORMALIZE_005 - * @tc.name : testNormalize005 - * @tc.desc : Normalizes this URI's path. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testNormalize005", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/./path/./aa/bb/cc?query#fagment"); - let res = gaogao.normalize(); - expect(res.path).assertEqual("/path/aa/bb/cc"); - expect(res.toString()).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/path/aa/bb/cc?query#fagment"); - }); - - /** - * @tc.number: TEST_TO_STRING_001 - * @tc.name : testToString001 - * @tc.desc : Returns the content of this URI as a US-ASCII string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString001", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment"); - let res = gaogao.toString(); - expect(res).assertEqual("http://gg:gaogao@[1:0:0:1:2:1:2:1]:99/../../path/.././../aa/bb/cc?query#fagment"); - }); - - /** - * @tc.number: TEST_TO_STRING_002 - * @tc.name : testToString002 - * @tc.desc : Returns the content of this URI as a US-ASCII string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString002", 0, function () { - let gaogao = new uri.URI("htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment"); - let res = gaogao.toString(); - expect(res).assertEqual("htt1p://gg:gaogao@[::192.9.5.5]:99/path/66path1?query#fagment"); - }); - - /** - * @tc.number: TEST_TO_STRING_003 - * @tc.name : testToString003 - * @tc.desc : Returns the content of this URI as a US-ASCII string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString003", 0, function () { - let gaogao = new uri.URI("ftp://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.toString(); - expect(res).assertEqual("ftp://username:password@www.baidu.com:88/path?query#fagment"); - }); - - /** - * @tc.number: TEST_TO_STRING_004 - * @tc.name : testToString004 - * @tc.desc : Returns the content of this URI as a US-ASCII string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString004", 0, function () { - let gaogao = new uri.URI("http://gg:gao你好gao@199.98.55.44:99/path/p你好ath?qu你好ery#fag你好ment"); - let res = gaogao.toString(); - expect(res).assertEqual("http://gg:gao%E4%BD%A0%E5%A5%BDgao@199.98.55.44:99/path/" + "p%E4%BD%A0%E5%A5%BDath?qu%E4%BD%A0%E5%A5%BDery#fag%E4%BD%A0%E5%A5%BDment"); - }); - - /** - * @tc.number: TEST_TO_STRING_005 - * @tc.name : testToString005 - * @tc.desc : Returns the content of this URI as a US-ASCII string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString005", 0, function () { - let gaogao = new uri.URI("http://gg:gaogao@199.98.55.44:99/path/path?query#fagment"); - let res = gaogao.toString(); - expect(res).assertEqual("http://gg:gaogao@199.98.55.44:99/path/path?query#fagment"); - }); - - /** - * @tc.number: TEST_CHECK_IS_ABSOLUTE_001 - * @tc.name : testCheckIsAbsolute001 - * @tc.desc : Tells whether or not this URI is absolute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCheckIsAbsolute001", 0, function () { - let gaogao = new uri.URI("f/tp://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.checkIsAbsolute(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_CHECK_IS_ABSOLUTE_002 - * @tc.name : testCheckIsAbsolute002 - * @tc.desc : Tells whether or not this URI is absolute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCheckIsAbsolute002", 0, function () { - let gaogao = new uri.URI("ftp://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.checkIsAbsolute(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_CHECK_IS_ABSOLUTE_003 - * @tc.name : testCheckIsAbsolute003 - * @tc.desc : Tells whether or not this URI is absolute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCheckIsAbsolute003", 0, function () { - let gaogao = new uri.URI("htt/p://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.checkIsAbsolute(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_CHECK_IS_ABSOLUTE_004 - * @tc.name : testCheckIsAbsolute004 - * @tc.desc : Tells whether or not this URI is absolute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCheckIsAbsolute004", 0, function () { - let gaogao = new uri.URI("https://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.checkIsAbsolute(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_CHECK_IS_ABSOLUTE_005 - * @tc.name : testCheckIsAbsolute005 - * @tc.desc : Tells whether or not this URI is absolute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCheckIsAbsolute005", 0, function () { - let gaogao = new uri.URI("http1://username:password@www.baidu.com:88/path?query#fagment"); - let res = gaogao.checkIsAbsolute(); - expect(res).assertEqual(true); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurietstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/app.json deleted file mode 100644 index 3db26ff7bcf9c8395c0ad34fa7ec2a3137e62dc3..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.url.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurletstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryurletstest/BUILD.gn deleted file mode 100644 index de2f0603382dbb49d33e37dd23eab2aeebf963e3..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformUrlTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformUrlTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/Test.json b/commonlibrary/crossplatform/commonlibraryurletstest/Test.json deleted file mode 100644 index 3e92f8d48416611457a3ee5b894307643f48278d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.url.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformUrlTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryurletstest/signature/openharmony_sx.p7b deleted file mode 100644 index 6059ac9e8d5df2ae5c1d7e8b89c197f682fcedf0..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurletstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 16cb8dd2dd14b4ee7a92e9020903bf214fdb36ed..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UrlFunTest from './url.test' - -export default function testsuite() { - UrlFunTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/url.test.ets b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/url.test.ets deleted file mode 100644 index 34671e7a3f26e1ff7f79aa66eedce0dcc71b6124..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/ets/test/url.test.ets +++ /dev/null @@ -1,1737 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -import Url from "@ohos.url"; -export default function UrlFunTest() { - describe("UrlFunTest", function () { - /** - * @tc.number: TEST_PARAMS_APPEND_001 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends a specified key/value pair as a new search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend001", 0, function () { - let that = Url.URL.parseURL("http://username:password@host:8080/directory/file?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append("ma", "jk"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2&ma=jk"); - }); - - /** - * @tc.number: TEST_PARAMS_APPEND_002 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends a specified key/value pair as a new search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend002", 0, function () { - let that = Url.URL.parseURL("http://username:password@host:8080/directory/file?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append("ma 大", "jk¥"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2&ma+%E5%A4%A7=jk%EF%BF%A5"); - }); - - /** - * @tc.number: TEST_PARAMS_APPEND_003 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends a specified key/value pair as a new search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend003", 0, function () { - let that = Url.URL.parseURL("http://username:password@host:8080/directory/file?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append("foo~!@#$%^&*()_+-=", "jk"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2&foo%7E%21%40%23%24%25%5E%26*%28%29_%2B-%3D=jk"); - }); - - /** - * @tc.number: TEST_PARAMS_APPEND_004 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends a specified key/value pair as a new search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend004", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append("app", "par"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2&app=par"); - }); - - /** - * @tc.number: TEST_PARAMS_APPEND_005 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends a specified key/value pair as a new search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend005", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append("123", "456"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2&123=456"); - }); - - /** - * @tc.number: TEST_PARAMS_APPEND_006 - * @tc.name : testParamsAppend001 - * @tc.desc : Appends throw BusinessError: Parameter error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsAppend006", 0, function () { - let a = "123"; - let b = undefined; - try { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.append(a, b); - expect(0).assertEqual(1); - } catch (err) { - expect(err.toString()).assertEqual(`BusinessError: Parameter error.The type of ${b} must be string`); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`Parameter error.The type of ${b} must be string`); - } - }); - - /** - * @tc.number: TEST_PARAMS_DELETE_001 - * @tc.name : testParamsDelete001 - * @tc.desc : Deletes the given search parameter and its associated value,from the list of all search parameters. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsDelete001", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.delete("foo"); - let result = params.toString(); - expect(result).assertEqual("bar=2"); - }); - - /** - * @tc.number: TEST_PARAMS_DELETE_002 - * @tc.name : testParamsDelete002 - * @tc.desc : Deletes the given search parameter and its associated value,from the list of all search parameters. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsDelete002", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo大=1&bar=2"); - let params = new Url.URLParams(that.search); - params.delete("foo"); - let result = params.toString(); - expect(result).assertEqual("foo%E5%A4%A7=1&bar=2"); - }); - - /** - * @tc.number: TEST_PARAMS_DELETE_003 - * @tc.name : testParamsDelete003 - * @tc.desc : Deletes the given search parameter and its associated value,from the list of all search parameters. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsDelete003", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo大=1&bar=2"); - let params = new Url.URLParams(that.search); - params.delete("foo大"); - let result = params.toString(); - expect(result).assertEqual("bar=2"); - }); - - /** - * @tc.number: TEST_PARAMS_DELETE_004 - * @tc.name : testParamsDelete004 - * @tc.desc : Deletes the given search parameter and its associated value,from the list of all search parameters. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsDelete004", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.delete("bar"); - let result = params.toString(); - expect(result).assertEqual("foo=1"); - }); - - /** - * @tc.number: TEST_PARAMS_DELETE_005 - * @tc.name : testParamsDelete005 - * @tc.desc : Deletes the given search parameter and its associated value,from the list of all search parameters. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsDelete005", 0, function () { - let that = Url.URL.parseURL("https://example.com?foo=1&bar=2"); - let params = new Url.URLParams(that.search); - params.delete("faa"); - let result = params.toString(); - expect(result).assertEqual("foo=1&bar=2"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_ALL_001 - * @tc.name : testParamsGetAll001 - * @tc.desc : Returns all key-value pairs associated with a given search parameter as an array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGetAll001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("key1", "AAA"); - let result = params.getAll("key1"); - expect(result.toString()).assertEqual("value1,AAA"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_ALL_002 - * @tc.name : testParamsGetAll002 - * @tc.desc : Returns all key-value pairs associated with a given search parameter as an array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGetAll002", 0, function () { - let params = new Url.URLParams("key1=value1&8=DEF"); - params.append("8", "A8A"); - let result = params.getAll("8"); - expect(result.toString()).assertEqual("DEF,A8A"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_ALL_003 - * @tc.name : testParamsGetAll003 - * @tc.desc : Returns all key-value pairs associated with a given search parameter as an array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGetAll003", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2&key3=da"); - params.append("key3", "A3A"); - let result = params.getAll("key3"); - expect(result.toString()).assertEqual("da,A3A"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_ALL_004 - * @tc.name : testParamsGetAll004 - * @tc.desc : Returns all key-value pairs associated with a given search parameter as an array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGetAll004", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2&key3=大"); - params.append("key3", "A3A"); - let result = params.getAll("key4"); - expect(result.toString()).assertEqual(""); - }); - - /** - * @tc.number: TEST_PARAMS_GET_ALL_005 - * @tc.name : testParamsGetAll005 - * @tc.desc : Returns all key-value pairs associated with a given search parameter as an array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGetAll005", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2&key3=大"); - params.append("key3", "A3A"); - let result = params.getAll("key2"); - expect(result.toString()).assertEqual("value2"); - }); - - /** - * @tc.number: TEST_PARAMS_ENTRIES_001 - * @tc.name : testParamsEntries001 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsEntries001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - - let i = 0; - let arr = {}; - for (let pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[1]).assertEqual("value1"); - }); - - /** - * @tc.number: TEST_PARAMS_ENTRIES_002 - * @tc.name : testParamsEntries002 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsEntries002", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let i = 0; - let arr = {}; - for (let pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[2]).assertEqual("key2"); - }); - - /** - * @tc.number: TEST_PARAMS_ENTRIES_003 - * @tc.name : testParamsEntries003 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsEntries003", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("foo", "jk"); - let i = 0; - let arr = {}; - for (let pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[5]).assertEqual("jk"); - }); - - /** - * @tc.number: TEST_PARAMS_ENTRIES_004 - * @tc.name : testParamsEntries004 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsEntries004", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let i = 0; - let arr = {}; - for (let pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[3]).assertEqual("value2"); - }); - - /** - * @tc.number: TEST_PARAMS_ENTRIES_005 - * @tc.name : testParamsEntries005 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsEntries005", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("jss", "txt"); - let i = 0; - let arr = {}; - for (let pair of params.entries()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[4]).assertEqual("jss"); - }); - - /** - * @tc.number: TEST_PARAMS_FOREACH_001 - * @tc.name : testParamsForEach001 - * @tc.desc : Callback functions are used to traverse key-value pairs on the URLParams instance object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsForEach001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let arr = {}; - let i = 0; - function func(value, key, SearchParams) { - arr[i] = value + " " + key + " " + (params === SearchParams); - i++; - } - params.forEach(func); - expect(arr[0]).assertEqual("value1 key1 true"); - }); - - /** - * @tc.number: TEST_PARAMS_FOREACH_002 - * @tc.name : testParamsForEach002 - * @tc.desc : Callback functions are used to traverse key-value pairs on the URLParams instance object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsForEach002", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let arr = {}; - let i = 0; - function func(value, key, SearchParams) { - arr[i] = value + " " + key + " " + (params === SearchParams); - i++; - } - params.forEach(func); - expect(arr[1]).assertEqual("value2 key2 true"); - }); - - /** - * @tc.number: TEST_PARAMS_FOREACH_003 - * @tc.name : testParamsForEach003 - * @tc.desc : Callback functions are used to traverse key-value pairs on the URLParams instance object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsForEach003", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("foo", "jk"); - let arr = {}; - let i = 0; - function func(value, key, SearchParams) { - arr[i] = value + " " + key + " " + (params === SearchParams); - i++; - } - params.forEach(func); - expect(arr[2]).assertEqual("jk foo true"); - }); - - /** - * @tc.number: TEST_PARAMS_FOREACH_004 - * @tc.name : testParamsForEach004 - * @tc.desc : Callback functions are used to traverse key-value pairs on the URLParams instance object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsForEach004", 0, function () { - let params = new Url.URLParams("foo=bar&jss=txt"); - let arr = {}; - let i = 0; - function func(value, key, SearchParams) { - arr[i] = value + " " + key + " " + (params === SearchParams); - i++; - } - params.forEach(func); - expect(arr[1]).assertEqual("txt jss true"); - }); - - /** - * @tc.number: TEST_PARAMS_FOREACH_005 - * @tc.name : testParamsForEach005 - * @tc.desc : Callback functions are used to traverse key-value pairs on the URLParams instance object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsForEach005", 0, function () { - let params = new Url.URLParams("foo=bar&jss=txt"); - params.append("foo", "jk"); - let arr = {}; - let i = 0; - function func(value, key, SearchParams) { - arr[i] = value + " " + key + " " + (params === SearchParams); - i++; - } - params.forEach(func); - expect(arr[0]).assertEqual("bar foo true"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_001 - * @tc.name : testParamsGet001 - * @tc.desc : Returns the first value associated to the given search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGet001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let result = params.get("1"); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_PARAMS_GET_002 - * @tc.name : testParamsGet002 - * @tc.desc : Returns the first value associated to the given search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGet002", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let result = params.get("key2"); - expect(result).assertEqual("value2"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_003 - * @tc.name : testParamsGet003 - * @tc.desc : Returns the first value associated to the given search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGet003", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("5", "JKL"); - let result = params.get("5"); - expect(result).assertEqual("JKL"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_004 - * @tc.name : testParamsGet004 - * @tc.desc : Returns the first value associated to the given search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGet004", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let result = params.get("key1"); - expect(result).assertEqual("value1"); - }); - - /** - * @tc.number: TEST_PARAMS_GET_005 - * @tc.name : testParamsGet005 - * @tc.desc : Returns the first value associated to the given search parameter. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsGet005", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("jss", "JL"); - let result = params.get("jss"); - expect(result).assertEqual("JL"); - }); - - /** - * @tc.number: TEST_PARAMS_HAS_001 - * @tc.name : testParamsHas001 - * @tc.desc : Returns a Boolean that indicates whether a parameter with the specified name exists. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsHas001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2&key3=大"); - let result = params.has("2"); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_PARAMS_HAS_002 - * @tc.name : testParamsHas002 - * @tc.desc : Returns a Boolean that indicates whether a parameter with the specified name exists. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsHas002", 0, function () { - let params = new Url.URLParams("小=value1&key2=value2&key3=大"); - let result = params.has("小"); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_PARAMS_HAS_003 - * @tc.name : testParamsHas003 - * @tc.desc : Returns a Boolean that indicates whether a parameter with the specified name exists. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsHas003", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大"); - params.append("¥", "ACA"); - let result = params.has("¥"); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_PARAMS_HAS_004 - * @tc.name : testParamsHas004 - * @tc.desc : Returns a Boolean that indicates whether a parameter with the specified name exists. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsHas004", 0, function () { - let params = new Url.URLParams("小=value1&key2=value2&key3=大"); - let result = params.has("无"); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_PARAMS_HAS_005 - * @tc.name : testParamsHas005 - * @tc.desc : Returns a Boolean that indicates whether a parameter with the specified name exists. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsHas005", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大"); - params.append("¥", "ACA"); - let result = params.has("¥11"); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_PARAMS_SET_001 - * @tc.name : testParamsSet001 - * @tc.desc : Sets the value associated with a given search parameter to the given value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet001", 0, function () { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("11", "CCC"); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=value2&key3=3&11=CCC"); - }); - - /** - * @tc.number: TEST_PARAMS_SET_002 - * @tc.name : testParamsSet002 - * @tc.desc : Sets the value associated with a given search parameter to the given value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet002", 0, function () { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("10", "BBB"); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=value2&key3=3&10=BBB"); - }); - - /** - * @tc.number: TEST_PARAMS_SET_003 - * @tc.name : testParamsSet003 - * @tc.desc : Sets the value associated with a given search parameter to the given value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet003", 0, function () { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("ma 大", "10¥"); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=value2&key3=3&ma+%E5%A4%A7=10%EF%BF%A5"); - }); - - /** - * @tc.number: TEST_PARAMS_SET_004 - * @tc.name : testParamsSet004 - * @tc.desc : Sets the value associated with a given search parameter to the given value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet004", 0, function () { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("1", "CCC"); - let res = params.toString(); - expect(res).assertEqual("1=CCC&2=value2&key3=3"); - }); - - /** - * @tc.number: TEST_PARAMS_SET_005 - * @tc.name : testParamsSet005 - * @tc.desc : Sets the value associated with a given search parameter to the given value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet005", 0, function () { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("12", "BBB"); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=value2&key3=3&12=BBB"); - }); - - /** - * @tc.number: TEST_PARAMS_SET_006 - * @tc.name : testParamsSet006 - * @tc.desc : toString throw BusinessError: Parameter error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - * If there were several matching values, this method deletes the others. - * If the search parameter doesn't exist, this method creates it. - */ - it("testParamsSet006", 0, function () { - let b = undefined; - try { - let params = new Url.URLParams("1=value1&2=value2&key3=3"); - params.set("12", b); - let res = params.toString(); - expect(0).assertEqual(1); - } catch (err) { - expect(err.toString()).assertEqual(`BusinessError: Parameter error.The type of ${b} must be string`); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`Parameter error.The type of ${b} must be string`); - } - }); - - /** - * @tc.number: TEST_PARAMS_SORT_001 - * @tc.name : testParamsSort001 - * @tc.desc : Sort all key/value pairs contained in this object in place and return undefined. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSort001", 0, function () { - let params = new Url.URLParams("1=value1&3=value3&2=key2"); - params.sort(); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=key2&3=value3"); - }); - - /** - * @tc.number: TEST_PARAMS_SORT_002 - * @tc.name : testParamsSort002 - * @tc.desc : Sort all key/value pairs contained in this object in place and return undefined. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSort002", 0, function () { - let params = new Url.URLParams("a=value1&c=value2&b=key2"); - params.sort(); - let res = params.toString(); - expect(res).assertEqual("a=value1&b=key2&c=value2"); - }); - - /** - * @tc.number: TEST_PARAMS_SORT_003 - * @tc.name : testParamsSort003 - * @tc.desc : Sort all key/value pairs contained in this object in place and return undefined. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSort003", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=33"); - params.append("a", "ACA"); - params.sort(); - let res = params.toString(); - expect(res).assertEqual("a=ACA&b=33&c=value2&d=value1"); - }); - - /** - * @tc.number: TEST_PARAMS_SORT_004 - * @tc.name : testParamsSort004 - * @tc.desc : Sort all key/value pairs contained in this object in place and return undefined. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSort004", 0, function () { - let params = new Url.URLParams("1=value1&3=value3&2=key2&4=key4"); - params.sort(); - let res = params.toString(); - expect(res).assertEqual("1=value1&2=key2&3=value3&4=key4"); - }); - - /** - * @tc.number: TEST_PARAMS_SORT_005 - * @tc.name : testParamsSort005 - * @tc.desc : Sort all key/value pairs contained in this object in place and return undefined. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSort005", 0, function () { - let params = new Url.URLParams("a=value1&c=value2&4=key4&b=key2"); - params.sort(); - let res = params.toString(); - expect(res).assertEqual("4=key4&a=value1&b=key2&c=value2"); - }); - - /** - * @tc.number: TEST_PARAMS_KEYS_001 - * @tc.name : testParamsKeys001 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsKeys001", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大"); - let arr = {}; - let i = 0; - for (let key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[0]).assertEqual("小"); - }); - - /** - * @tc.number: TEST_PARAMS_KEYS_002 - * @tc.name : testParamsKeys002 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsKeys002", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大"); - let arr = {}; - let i = 0; - for (let key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[1]).assertEqual("¥"); - }); - - /** - * @tc.number: TEST_PARAMS_KEYS_003 - * @tc.name : testParamsKeys003 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsKeys003", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大"); - let arr = {}; - let i = 0; - for (let key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[2]).assertEqual("key3"); - }); - - /** - * @tc.number: TEST_PARAMS_KEYS_004 - * @tc.name : testParamsKeys004 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsKeys004", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大&key4=六"); - let arr = {}; - let i = 0; - for (let key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[3]).assertEqual("key4"); - }); - - /** - * @tc.number: TEST_PARAMS_KEYS_005 - * @tc.name : testParamsKeys005 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsKeys005", 0, function () { - let params = new Url.URLParams("小=value1&¥=value2&key3=大&key4=六&key5=发"); - let arr = {}; - let i = 0; - for (let key of params.keys()) { - arr[i] = key; - i++; - } - expect(arr[4]).assertEqual("key5"); - }); - - /** - * @tc.number: TEST_PARAMS_VALUES_001 - * @tc.name : testParamsValues001 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsValues001", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大"); - let arr = {}; - let i = 0; - for (let value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[0]).assertEqual("value1"); - }); - - /** - * @tc.number: TEST_PARAMS_VALUES_002 - * @tc.name : testParamsValues002 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsValues002", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大"); - let arr = {}; - let i = 0; - for (let value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[1]).assertEqual("value2"); - }); - - /** - * @tc.number: TEST_PARAMS_VALUES_003 - * @tc.name : testParamsValues003 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsValues003", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大"); - params.append("a", "ACA"); - let arr = {}; - let i = 0; - for (let value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[3]).assertEqual("ACA"); - }); - - /** - * @tc.number: TEST_PARAMS_VALUES_004 - * @tc.name : testParamsValues004 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsValues004", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大&4=key4"); - let arr = {}; - let i = 0; - for (let value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[3]).assertEqual("key4"); - }); - - /** - * @tc.number: TEST_PARAMS_VALUES_005 - * @tc.name : testParamsValues005 - * @tc.desc : Returns an iterator allowing to go through all keys contained in this object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsValues005", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大&4=key4&5=key5"); - let arr = {}; - let i = 0; - for (let value of params.values()) { - arr[i] = value; - i++; - } - expect(arr[4]).assertEqual("key5"); - }); - - /** - * @tc.number: TEST_PARAMS_SYMBOL_ITERATOR_001 - * @tc.name : testParamsSymbolIterator001 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSymbolIterator001", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let i = 0; - let arr = {}; - for (let pair of params[Symbol.iterator]()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[1]).assertEqual("value1"); - }); - - /** - * @tc.number: TEST_PARAMS_SYMBOL_ITERATOR_002 - * @tc.name : testParamsSymbolIterator002 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSymbolIterator002", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let i = 0; - let arr = {}; - for (let pair of params[Symbol.iterator]()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[2]).assertEqual("key2"); - }); - - /** - * @tc.number: TEST_PARAMS_SYMBOL_ITERATOR_003 - * @tc.name : testParamsSymbolIterator003 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSymbolIterator003", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("foo", "jk"); - let i = 0; - let arr = {}; - for (let pair of params[Symbol.iterator]()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[5]).assertEqual("jk"); - }); - - /** - * @tc.number: TEST_PARAMS_SYMBOL_ITERATOR_004 - * @tc.name : testParamsSymbolIterator004 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSymbolIterator004", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - let i = 0; - let arr = {}; - for (let pair of params[Symbol.iterator]()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[3]).assertEqual("value2"); - }); - - /** - * @tc.number: TEST_PARAMS_SYMBOL_ITERATOR_005 - * @tc.name : testParamsSymbolIterator005 - * @tc.desc : Returns an ES6 iterator. Each item of the iterator is a JavaScript Array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsSymbolIterator005", 0, function () { - let params = new Url.URLParams("key1=value1&key2=value2"); - params.append("jss", "txt"); - let i = 0; - let arr = {}; - for (let pair of params[Symbol.iterator]()) { - arr[i] = pair[0]; - i++; - arr[i] = pair[1]; - i++; - } - expect(arr[4]).assertEqual("jss"); - }); - - /** - * @tc.number: TEST_PARAMS_TO_STRING_001 - * @tc.name : testParamsToString001 - * @tc.desc : Returns a query string suitable for use in a URL. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsToString001", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大"); - let result = params.toString(); - expect(result).assertEqual("d=value1&c=value2&b=%E5%A4%A7"); - }); - - /** - * @tc.number: TEST_PARAMS_TO_STRING_002 - * @tc.name : testParamsToString002 - * @tc.desc : Returns a query string suitable for use in a URL. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsToString002", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b= 大"); - params.append("1 12", "QQQ"); - let result = params.toString(); - expect(result).assertEqual("d=value1&c=value2&b=+%E5%A4%A7&1+12=QQQ"); - }); - - /** - * @tc.number: TEST_PARAMS_TO_STRING_003 - * @tc.name : testParamsToString003 - * @tc.desc : Returns a query string suitable for use in a URL. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsToString003", 0, function () { - let params = new Url.URLParams("$=()"); - params.delete("5"); - let result = params.toString(); - expect(result).assertEqual("%24=%28%29"); - }); - - /** - * @tc.number: TEST_PARAMS_TO_STRING_004 - * @tc.name : testParamsToString004 - * @tc.desc : Returns a query string suitable for use in a URL. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsToString004", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b=大&4=key4"); - let result = params.toString(); - expect(result).assertEqual("d=value1&c=value2&b=%E5%A4%A7&4=key4"); - }); - - /** - * @tc.number: TEST_PARAMS_TO_STRING_005 - * @tc.name : testParamsToString005 - * @tc.desc : Returns a query string suitable for use in a URL. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsToString005", 0, function () { - let params = new Url.URLParams("d=value1&c=value2&b= 大&4=key4&5=key5"); - params.append("1 12", "QQQ"); - let result = params.toString(); - expect(result).assertEqual("d=value1&c=value2&b=+%E5%A4%A7&4=key4&5=key5&1+12=QQQ"); - }); - - /** - * @tc.number: TEST_URL_TO_STRING_001 - * @tc.name : testUrlToString001 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToString001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.toString(); - expect(result).assertEqual("http://username:password@host:8080/directory/file?query#fragment"); - }); - - /** - * @tc.number: TEST_URL_TO_STRING_002 - * @tc.name : testUrlToString002 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToString002", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file"); - let result = params.toString(); - expect(result).assertEqual("http://username:password@host:8080/directory/file"); - }); - - /** - * @tc.number: TEST_URL_TO_STRING_003 - * @tc.name : testUrlToString003 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToString003", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080#fragment"); - let result = params.toString(); - expect(result).assertEqual("http://username:password@host:8080/#fragment"); - }); - - /** - * @tc.number: TEST_URL_TO_STRING_004 - * @tc.name : testUrlToString004 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToString004", 0, function () { - let params = Url.URL.parseURL("http1://host/directory/file?query#fragment"); - let result = params.toString(); - expect(result).assertEqual("http1://host/directory/file?query#fragment"); - }); - - /** - * @tc.number: TEST_URL_TO_STRING_005 - * @tc.name : testUrlToString005 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToString005", 0, function () { - let params = Url.URL.parseURL("http:host:8080/directory/file?query#fragment"); - let result = params.toString(); - expect(result).assertEqual("http://host:8080/directory/file?query#fragment"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_001 - * @tc.name : testUrlParseUrl001 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl001", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL("https://developer.mozilla.org"); - let result = params2.href; - expect(result).assertEqual("https://developer.mozilla.org/"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_002 - * @tc.name : testUrlParseUrl002 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl002", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL("https://developer.mozilla.org", "flie:/developer.mozilla.org"); - let result = params2.href; - expect(result).assertEqual("https://developer.mozilla.org/"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_003 - * @tc.name : testUrlParseUrl003 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl003", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL("https://developer.mozilla.org", "ftp://www.example.com"); - let result = params2.href; - expect(result).assertEqual("https://developer.mozilla.org/"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_004 - * @tc.name : testUrlParseUrl004 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl004", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL(" ", "http://www.example.com"); - let result = params2.href; - expect(result).assertEqual("http://www.example.com/"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_005 - * @tc.name : testUrlParseUrl005 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl005", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL(".", "http://www.example.com"); - let result = params2.href; - expect(result).assertEqual("http://www.example.com/"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_006 - * @tc.name : testUrlParseUrl006 - * @tc.desc : URL constructor, which is used to instantiate a URL object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl006", 0, function () { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let params2 = Url.URL.parseURL("../h:", "http://www.example.com"); - let result = params2.href; - expect(result).assertEqual("http://www.example.com/h:"); - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_007 - * @tc.name : testUrlParseUrl007 - * @tc.desc : URL constructor, BusinessError: Parameter error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl007", 0, function () { - let a = undefined; - try { - let params = new Url.URL(); - expect(params != null).assertTrue(); - Url.URL.parseURL(a); - expect(0).assertEqual(1); - } catch (err) { - expect(err.toString()).assertEqual(`BusinessError: Parameter error.The type of ${a} must be string`); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`Parameter error.The type of ${a} must be string`); - } - }); - - /** - * @tc.number: TEST_URL_PARSE_URL_008 - * @tc.name : testUrlParseUrl008 - * @tc.desc : URL constructor, throw BusinessError: Syntax Error. Invalid Url string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlParseUrl008", 0, function () { - try { - let params = new Url.URL(); - expect(params != null).assertTrue(); - let a = "666666"; - let b = "666666"; - Url.URL.parseURL(a, b); - expect(0).assertEqual(1); - } catch (err) { - expect(err.toString()).assertEqual(`BusinessError: Syntax Error. Invalid Url string`); - expect(err.code).assertEqual(10200002); - expect(err.message).assertEqual(`Syntax Error. Invalid Url string`); - } - }); - - /** - * @tc.number: TEST_URL_TO_JSON_001 - * @tc.name : testUrlToJson001 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToJson001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query=pppppp#qwer=da"); - let result = params.toJSON(); - expect(result).assertEqual("http://username:password@host:8080/directory/file?query=pppppp#qwer=da"); - }); - - /** - * @tc.number: TEST_URL_TO_JSON_002 - * @tc.name : testUrlToJson002 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToJson002", 0, function () { - let params = Url.URL.parseURL("http://host:8080/directory/file?query=pppppp#qwer=da"); - let result = params.toJSON(); - expect(result).assertEqual("http://host:8080/directory/file?query=pppppp#qwer=da"); - }); - - /** - * @tc.number: TEST_URL_TO_JSON_003 - * @tc.name : testUrlToJson003 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToJson003", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080"); - let result = params.toJSON(); - expect(result).assertEqual("http://username:password@host:8080/"); - }); - - /** - * @tc.number: TEST_URL_TO_JSON_004 - * @tc.name : testUrlToJson004 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToJson004", 0, function () { - let params = Url.URL.parseURL("http11://username:password@host:8080?query=pppppp#qwer=da"); - let result = params.toJSON(); - expect(result).assertEqual("http11://username:password@host:8080?query=pppppp#qwer=da"); - }); - - /** - * @tc.number: TEST_URL_TO_JSON_005 - * @tc.name : testUrlToJson005 - * @tc.desc : Returns the serialized URL as a string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUrlToJson005", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory"); - let result = params.toJSON(); - expect(result).assertEqual("http://username:password@host:8080/directory"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_001 - * @tc.name : testParamsConstruction001 - * @tc.desc : A parameterized constructor used to create an URLParams instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction001", 0, function () { - let params = new Url.URLParams("?user=abc&query=xyz"); - let result = params.toString(); - expect(result).assertEqual("user=abc&query=xyz"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_002 - * @tc.name : testParamsConstruction002 - * @tc.desc : A parameterized constructor used to create an URLParams instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction002", 0, function () { - let params = new Url.URLParams({ - user: "abc", - query: "first", - }); - let result = params.toString(); - expect(result).assertEqual("user=abc&query=first"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_003 - * @tc.name : testParamsConstruction003 - * @tc.desc : A parameterized constructor used to create an URLParams instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction003", 0, function () { - let params = new Url.URLParams([ - ["user", "abc"], - ["query", "first"], - ["query", "second"], - ]); - let result = params.toString(); - expect(result).assertEqual("user=abc&query=first&query=second"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_004 - * @tc.name : testParamsConstruction004 - * @tc.desc : A parameterized constructor used to create an URLParams instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction004", 0, function () { - let params = new Url.URLParams(); - params.append("abcde", "fghki"); - let paramsResult = params.toString(); - expect(paramsResult).assertEqual("abcde=fghki"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_005 - * @tc.name : testParamsConstruction005 - * @tc.desc : A parameterized constructor used to create an URLParams instance. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction005", 0, function () { - let param; - let params = new Url.URLParams(param); - params.append("abcde", "fghki"); - let paramsResult = params.toString(); - expect(paramsResult).assertEqual("abcde=fghki"); - }); - - /** - * @tc.number: TEST_PARAMS_CONSTRUCTION_006 - * @tc.name : testParamsConstruction006 - * @tc.desc : BusinessError: Parameter error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParamsConstruction006", 0, function () { - let param = [["user", "abc", "error"]]; - try { - let params = new Url.URLParams(param); - expect(0).assertEqual(1); - } catch (err) { - expect(err.toString()).assertEqual(`BusinessError: Parameter error.The type of ${param} must be string[][]`); - expect(err.code).assertEqual(401); - expect(err.message).assertEqual(`Parameter error.The type of ${param} must be string[][]`); - } - }); - - /** - * @tc.number: TEST_URL_HASH_001 - * @tc.name : testUrlHash001 - * @tc.desc : Gets and sets the fragment portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlHash001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query=pppppp#fragment"); - let result = params.hash; - expect(result).assertEqual("#fragment"); - }); - - /** - * @tc.number: TEST_URL_HOST_001 - * @tc.name : testUrlHost001 - * @tc.desc : Gets and sets the host portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlHost001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.host; - expect(result).assertEqual("host:8080"); - }); - - /** - * @tc.number: TEST_URL_HOST_NAME_001 - * @tc.name : testUrlHostName001 - * @tc.desc : Gets and sets the host name portion of the URL,not include the port. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlHostName001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.hostname; - expect(result).assertEqual("host"); - }); - - /** - * @tc.number: TEST_URL_HREF_001 - * @tc.name : testUrlHref001 - * @tc.desc : Gets and sets the serialized URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlHref001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.href; - expect(result).assertEqual("http://username:password@host:8080/directory/file?query#fragment"); - }); - - /** - * @tc.number: TEST_URL_ORIGIN_001 - * @tc.name : testUrlOrigin001 - * @tc.desc : Gets the read-only serialization of the URL's origin. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlOrigin001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.origin; - expect(result).assertEqual("http://host:8080"); - }); - - /** - * @tc.number: TEST_URL_PASSWORD_001 - * @tc.name : testUrlPassword001 - * @tc.desc : Gets and sets the password portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlPassword001", 0, function () { - let params = Url.URL.parseURL("http://username:11@host:8080/directory/file?query#fragment"); - let result = params.password; - expect(result).assertEqual("11"); - }); - - /** - * @tc.number: TEST_URL_PATHNAME_001 - * @tc.name : testUrlPathName001 - * @tc.desc : Gets and sets the path portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlPathName001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.pathname; - expect(result).assertEqual("/directory/file"); - }); - - /** - * @tc.number: TEST_URL_PORT_001 - * @tc.name : testUrlPort001 - * @tc.desc : Gets and sets the port portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlPort001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.port; - expect(result).assertEqual("8080"); - }); - - /** - * @tc.number: TEST_URL_PROTOCOL_001 - * @tc.name : testUrlProtocol001 - * @tc.desc : Gets and sets the protocol portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlProtocol001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.protocol; - expect(result).assertEqual("http:"); - }); - - /** - * @tc.number: TEST_URL_SEARCH_001 - * @tc.name : testUrlSearch001 - * @tc.desc : Gets and sets the serialized query portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlSearch001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query=qqqq#fragment"); - let result = params.search; - expect(result).assertEqual("?query=qqqq"); - }); - - /** - * @tc.number: TEST_URL_URL_PARAMS_001 - * @tc.name : testUrlURLParams001 - * @tc.desc : Gets the SearchParams portion of the URL - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlURLParams001", 0, function () { - let that = Url.URL.parseURL("http://username:password@host:8080/directory/file?foo=1&bar=2"); - let seach = that.params; - let result = seach.toString(); - expect(result).assertEqual("foo=1&bar=2"); - }); - - /** - * @tc.number: TEST_URL_USERNAME_001 - * @tc.name : testUrlUserName001 - * @tc.desc : Gets and sets the username portion of the URL. - * @tc.size : MediumTest - * @tc.type : Field - * @tc.level : Level 0 - */ - it("testUrlUserName001", 0, function () { - let params = Url.URL.parseURL("http://username:password@host:8080/directory/file?query#fragment"); - let result = params.username; - expect(result).assertEqual("username"); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryurletstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/app.json deleted file mode 100644 index d75ce8e2fde559f5d7ddc39fc97a2c5d03eaa8f5..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.util.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryutiletstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryutiletstest/BUILD.gn deleted file mode 100644 index 0190c57bc1a6667ae0d5fa2cc433ea737a5a903d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/BUILD.gn +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformUtilTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - - # hap_name: HAP的名字,可选,默认为目标名 - hap_name = "ActsCrossplatformUtilTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - # app_profile: HAP的AppScope中的app.json,只在Stage模型下使用 - app_profile = "AppScope/app.json" - - # sources: 资源文件路径 - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - # source_dir: js或ets代码路径,兼容FA模型的单ability配置到ability目录 - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - # sources: 资源文件路径 - sources = [ "src/main/resources" ] - - # deps: 当前目标的依赖 - deps = [ ":windowStage_app_profile" ] - - # hap_profile: HAP的config.json,Stage模型对应module.json - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/Test.json b/commonlibrary/crossplatform/commonlibraryutiletstest/Test.json deleted file mode 100644 index 7111f525c91ea4be3c9befb205550cdfd080b906..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/Test.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - // 指定设备执行的驱动 - "driver": { - "type": "OHJSUnitTest", - //test-timeout: 测试hap 整体执行用例的执行时长 - "test-timeout": "60000", - //shell-timeout: aa test 拉起命令执行时长 - "shell-timeout": "60000", - //bundle-name: 与HAP的app.json 中 bundleName 保持一致 - "bundle-name": "ohos.acts.commonlibrary.crossplatform.util.normal", - //module-name: 与HAP的module.json 中"module"字段的 name 保持一致 - "module-name": "entry_test" - //testcase-timeout: 测试hap 单条用例的执行时长 - //"testcase-timeout": 5000 - }, - // kit的作用主要是为了支撑测试执行活动,在测试前执行预制操作(Setup),在测试后执行清理操作(Teardown) - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformUtilTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryutiletstest/signature/openharmony_sx.p7b deleted file mode 100644 index 0b970cc53c2a9991ff7446fee899799b0f00586a..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryutiletstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index 368aef9190e386ca17d015688d69169e208f6924..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index e9564089921924d8b378cf1df07861df17457c90..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/List.test.ets deleted file mode 100644 index db667fe9df854aa24c958190e883b199ccff2fc0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UtilFunTest from './util.test' - -export default function testsuite() { - UtilFunTest() -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/util.test.ets b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/util.test.ets deleted file mode 100644 index 5b32091c19faaf98f4928185121a2b6ce9472a24..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/ets/test/util.test.ets +++ /dev/null @@ -1,8226 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium"; -import util from "@ohos.util"; -import url from "@ohos.url"; -import app from "@system.app"; -import process from "@ohos.process"; -import request from "@ohos.request"; - -class Temperature { - private readonly _temp: Temperature; - - constructor(value) { - this._temp = value; - } - compareTo(value) { - return this._temp >= value.getTemp(); - } - getTemp() { - return this._temp; - } - toString() { - return this._temp.toString(); - } -} -let tempLower = new Temperature(30); -let tempUpper = new Temperature(40); -let tempLess = new Temperature(20); -let tempMiDF = new Temperature(35); -let tempMidS = new Temperature(39); -let tempMore = new Temperature(45); - -let rangeHp = new util.ScopeHelper(tempLower, tempUpper); -let rangeHpFir = new util.ScopeHelper(tempMiDF, tempMidS); -let rangeHpSec = new util.ScopeHelper(tempLess, tempMore); -let rangeHpThi = new util.ScopeHelper(tempLess, tempMiDF); -let rangeHpFif = new util.ScopeHelper(tempMiDF, tempMore); - -export default function UtilFunTest() { - describe("UtilTest", function () { - /** - * @tc.number: TEST_IS_NUMBER_OBJECT_001 - * @tc.name : testIsNumberObject001 - * @tc.desc : Check whether the entered value is of the number object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNumberObject001", 0, function () { - let proc = new util.types(); - let result = proc.isNumberObject(new Number(0)); - expect(result).assertEqual(true); - }); - /** - * @tc.number: TEST_IS_NUMBER_OBJECT_002 - * @tc.name : testIsNumberObject002 - * @tc.desc : Check whether the entered value is of the number object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNumberObject002", 0, function () { - let proc = new util.types(); - let result = proc.isNumberObject(new Number(10)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NUMBER_OBJECT_003 - * @tc.name : testIsNumberObject003 - * @tc.desc : Check whether the entered value is of the number object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNumberObject003", 0, function () { - let proc = new util.types(); - let result = proc.isNumberObject(new Number(200)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NUMBER_OBJECT_004 - * @tc.name : testIsNumberObject004 - * @tc.desc : Check whether the entered value is of the number object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNumberObject004", 0, function () { - let proc = new util.types(); - let result = proc.isNumberObject(0); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NUMBER_OBJECT_005 - * @tc.name : testIsNumberObject005 - * @tc.desc : Check whether the entered value is of the number object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNumberObject005", 0, function () { - let proc = new util.types(); - let result = proc.isNumberObject(100); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_PROMISE_001 - * @tc.name : testIsPromise001 - * @tc.desc : Check whether the entered value is of promise type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsPromise001", 0, function () { - let proc = new util.types(); - let result = proc.isPromise(Promise.resolve(42)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROMISE_002 - * @tc.name : testIsPromise002 - * @tc.desc : Check whether the entered value is of promise type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsPromise002", 0, function () { - let proc = new util.types(); - let result = proc.isPromise(Promise.resolve(33)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROMISE_003 - * @tc.name : testIsPromise003 - * @tc.desc : Check whether the entered value is of promise type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsPromise003", 0, function () { - let proc = new util.types(); - let result = proc.isPromise(Promise.resolve(44)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROMISE_004 - * @tc.name : testIsPromise004 - * @tc.desc : Check whether the entered value is of promise type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsPromise004", 0, function () { - let proc = new util.types(); - let err = Error("33"); - let result = proc.isPromise(Promise.reject(err)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROMISE_005 - * @tc.name : testIsPromise005 - * @tc.desc : Check whether the entered value is of promise type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsPromise005", 0, function () { - let proc = new util.types(); - let err = Error("23"); - let result = proc.isPromise(Promise.reject(err)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROXY_001 - * @tc.name : testIsProxy001 - * @tc.desc : Check whether the value entered is of proxy type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsProxy001", 0, function () { - let proc = new util.types(); - const target = {}; - const proxy = new Proxy(target, {}); - let result = proc.isProxy(proxy); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROXY_002 - * @tc.name : testIsProxy002 - * @tc.desc : Check whether the value entered is of proxy type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsProxy002", 0, function () { - let proc = new util.types(); - const target = {}; - let result = proc.isProxy(target); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_PROXY_003 - * @tc.name : testIsProxy003 - * @tc.desc : Check whether the value entered is of proxy type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsProxy003", 0, function () { - let proc = new util.types(); - const handler = { - get: function (obj, prop) { - return prop in obj ? obj[prop] : 37; - }, - }; - const p = new Proxy({}, handler); - let result = proc.isProxy(p); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROXY_004 - * @tc.name : testIsProxy004 - * @tc.desc : Check whether the value entered is of proxy type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsProxy004", 0, function () { - let proc = new util.types(); - const handler = { - get: function (obj, prop) { - return prop in obj ? obj[prop] : 121; - }, - }; - const p = new Proxy({}, handler); - let result = proc.isProxy(p); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_PROXY_005 - * @tc.name : testIsProxy005 - * @tc.desc : Check whether the value entered is of proxy type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsProxy005", 0, function () { - let proc = new util.types(); - const handler = { - get: function (obj, prop) { - return prop in obj ? obj[prop] : 121; - }, - }; - let result = proc.isProxy(handler); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_REG_EXP_001 - * @tc.name : testIsRegExp001 - * @tc.desc : Check whether the entered value is of type regexp. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsRegExp001", 0, function () { - let proc = new util.types(); - let result = proc.isRegExp(new RegExp("abc")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_REG_EXP_002 - * @tc.name : testIsRegExp002 - * @tc.desc : Check whether the entered value is of type regexp. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsRegExp002", 0, function () { - let proc = new util.types(); - let result = proc.isRegExp(/abc/); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_REG_EXP_003 - * @tc.name : testIsRegExp003 - * @tc.desc : Check whether the entered value is of type regexp. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsRegExp003", 0, function () { - let proc = new util.types(); - let result = proc.isRegExp(new RegExp("fgd")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_REG_EXP_004 - * @tc.name : testIsRegExp004 - * @tc.desc : Check whether the entered value is of type regexp. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsRegExp004", 0, function () { - let proc = new util.types(); - let result = proc.isRegExp(new RegExp("123")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_REG_EXP_005 - * @tc.name : testIsRegExp005 - * @tc.desc : Check whether the entered value is of type regexp. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsRegExp005", 0, function () { - let proc = new util.types(); - let result = proc.isRegExp(new RegExp(/ab+c/, "i")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_001 - * @tc.name : testIsSet001 - * @tc.desc : Check whether the entered value is of type set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSet001", 0, function () { - let proc = new util.types(); - let result = proc.isSet(new Set()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_002 - * @tc.name : testIsSet002 - * @tc.desc : Check whether the entered value is of type set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSet002", 0, function () { - let proc = new util.types(); - let result = proc.isSet(new Map()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SET_003 - * @tc.name : testIsSet003 - * @tc.desc : Check whether the entered value is of type set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSet003", 0, function () { - let proc = new util.types(); - let result = proc.isSet(new String()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SET_004 - * @tc.name : testIsSet004 - * @tc.desc : Check whether the entered value is of type set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSet004", 0, function () { - let proc = new util.types(); - let result = proc.isSet(new Boolean()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SET_005 - * @tc.name : testIsSet005 - * @tc.desc : Check whether the entered value is of type set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSet005", 0, function () { - let proc = new util.types(); - let result = proc.isSet(new WeakSet()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SET_ITERATOR_001 - * @tc.name : testIsSetIterator001 - * @tc.desc : Check whether the entered value is the iterator type of set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSetIterator001", 0, function () { - let proc = new util.types(); - const set = new Set(); - let result = proc.isSetIterator(set.keys()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_ITERATOR_002 - * @tc.name : testIsSetIterator002 - * @tc.desc : Check whether the entered value is the iterator type of set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSetIterator002", 0, function () { - let proc = new util.types(); - const set = new Set(); - let result = proc.isSetIterator(set.values()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_ITERATOR_003 - * @tc.name : testIsSetIterator003 - * @tc.desc : Check whether the entered value is the iterator type of set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSetIterator003", 0, function () { - let proc = new util.types(); - const set = new Set(); - let result = proc.isSetIterator(set.entries()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_ITERATOR_004 - * @tc.name : testIsSetIterator004 - * @tc.desc : Check whether the entered value is the iterator type of set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSetIterator004", 0, function () { - let proc = new util.types(); - const set = new Set(); - let result = proc.isSetIterator(set[Symbol.iterator]()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SET_ITERATOR_005 - * @tc.name : testIsSetIterator005 - * @tc.desc : Check whether the entered value is the iterator type of set. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSetIterator005", 0, function () { - let proc = new util.types(); - const set = new Set(); - let result = proc.isSetIterator(set); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SHARED_ARRAY_BUFFER_001 - * @tc.name : testIsSharedArrayBuffer001 - * @tc.desc : Check whether the entered value is of type sharedarraybuffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSharedArrayBuffer001", 0, function () { - let proc = new util.types(); - let result = proc.isSharedArrayBuffer(new SharedArrayBuffer(0)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SHARED_ARRAY_BUFFER_002 - * @tc.name : testIsSharedArrayBuffer002 - * @tc.desc : Check whether the entered value is of type sharedarraybuffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSharedArrayBuffer002", 0, function () { - let proc = new util.types(); - let result = proc.isSharedArrayBuffer(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SHARED_ARRAY_BUFFER_003 - * @tc.name : testIsSharedArrayBuffer003 - * @tc.desc : Check whether the entered value is of type sharedarraybuffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSharedArrayBuffer003", 0, function () { - let proc = new util.types(); - let result = proc.isSharedArrayBuffer(new Int32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SHARED_ARRAY_BUFFER_004 - * @tc.name : testIsSharedArrayBuffer004 - * @tc.desc : Check whether the entered value is of type sharedarraybuffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSharedArrayBuffer004", 0, function () { - let proc = new util.types(); - let result = proc.isSharedArrayBuffer(new ArrayBuffer(1)); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SHARED_ARRAY_BUFFER_005 - * @tc.name : testIsSharedArrayBuffer005 - * @tc.desc : Check whether the entered value is of type sharedarraybuffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSharedArrayBuffer005", 0, function () { - let proc = new util.types(); - let result = proc.isSharedArrayBuffer(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_STRING_OBJECT_001 - * @tc.name : testIsStringObject001 - * @tc.desc : Check whether the entered value is a string object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsStringObject001", 0, function () { - let proc = new util.types(); - let result = proc.isStringObject(new String("foo")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_STRING_OBJECT_002 - * @tc.name : testIsStringObject002 - * @tc.desc : Check whether the entered value is a string object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsStringObject002", 0, function () { - let proc = new util.types(); - let result = proc.isStringObject(new String("twoo")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_STRING_OBJECT_003 - * @tc.name : testIsStringObject003 - * @tc.desc : Check whether the entered value is a string object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsStringObject003", 0, function () { - let proc = new util.types(); - let result = proc.isStringObject(new String("fdfsfd")); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_STRING_OBJECT_004 - * @tc.name : testIsStringObject004 - * @tc.desc : Check whether the entered value is a string object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsStringObject004", 0, function () { - let proc = new util.types(); - let result = proc.isStringObject("ffds111"); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_STRING_OBJECT_005 - * @tc.name : testIsStringObject005 - * @tc.desc : Check whether the entered value is a string object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsStringObject005", 0, function () { - let proc = new util.types(); - let result = proc.isStringObject("foo"); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SYMBOL_OBJECT_001 - * @tc.name : testIsSymbolObject001 - * @tc.desc : Check whether the entered value is a symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSymbolObject001", 0, function () { - let proc = new util.types(); - const symbols = Symbol("foo"); - let result = proc.isSymbolObject(Object(symbols)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SYMBOL_OBJECT_002 - * @tc.name : testIsSymbolObject002 - * @tc.desc : Check whether the entered value is a symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSymbolObject002", 0, function () { - let proc = new util.types(); - const symbols = Symbol("s12"); - let result = proc.isSymbolObject(Object(symbols)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SYMBOL_OBJECT_003 - * @tc.name : testIsSymbolObject003 - * @tc.desc : Check whether the entered value is a symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSymbolObject003", 0, function () { - let proc = new util.types(); - const symbols = Symbol("sads"); - let result = proc.isSymbolObject(Object(symbols)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_SYMBOL_OBJECT_004 - * @tc.name : testIsSymbolObject004 - * @tc.desc : Check whether the entered value is a symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSymbolObject004", 0, function () { - let proc = new util.types(); - const symbols = Symbol("asdd"); - let result = proc.isSymbolObject(symbols); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_SYMBOL_OBJECT_005 - * @tc.name : testIsSymbolObject005 - * @tc.desc : Check whether the entered value is a symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsSymbolObject005", 0, function () { - let proc = new util.types(); - const symbols = Symbol("foo"); - let result = proc.isSymbolObject(symbols); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_TYPED_ARRAY_001 - * @tc.name : testIsTypedArray001 - * @tc.desc : Check whether the entered value is a type contained in typedarray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsTypedArray001", 0, function () { - let proc = new util.types(); - let result = proc.isTypedArray(new Float64Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_TYPED_ARRAY_002 - * @tc.name : testIsTypedArray002 - * @tc.desc : Check whether the entered value is a type contained in typedarray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsTypedArray002", 0, function () { - let proc = new util.types(); - let result = proc.isTypedArray(new Uint8Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_TYPED_ARRAY_003 - * @tc.name : testIsTypedArray003 - * @tc.desc : Check whether the entered value is a type contained in typedarray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsTypedArray003", 0, function () { - let proc = new util.types(); - let result = proc.isTypedArray(new Uint16Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_TYPED_ARRAY_004 - * @tc.name : testIsTypedArray004 - * @tc.desc : Check whether the entered value is a type contained in typedarray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsTypedArray004", 0, function () { - let proc = new util.types(); - let result = proc.isTypedArray(new Uint32Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_TYPED_ARRAY_005 - * @tc.name : testIsTypedArray005 - * @tc.desc : Check whether the entered value is a type contained in typedarray. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsTypedArray005", 0, function () { - let proc = new util.types(); - let result = proc.isTypedArray(new ArrayBuffer(0)); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_ARRAY_001 - * @tc.name : testIsUint8Array001 - * @tc.desc : Check whether the entered value is the uint8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8Array001", 0, function () { - let proc = new util.types(); - let result = proc.isUint8Array(new Uint8Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_UINT8_ARRAY_002 - * @tc.name : testIsUint8Array002 - * @tc.desc : Check whether the entered value is the uint8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8Array002", 0, function () { - let proc = new util.types(); - let result = proc.isUint8Array(new Uint16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_ARRAY_003 - * @tc.name : testIsUint8Array003 - * @tc.desc : Check whether the entered value is the uint8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8Array003", 0, function () { - let proc = new util.types(); - let result = proc.isUint8Array(new Uint32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_ARRAY_004 - * @tc.name : testIsUint8Array004 - * @tc.desc : Check whether the entered value is the uint8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8Array004", 0, function () { - let proc = new util.types(); - let result = proc.isUint8Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_ARRAY_005 - * @tc.name : testIsUint8Array005 - * @tc.desc : Check whether the entered value is the uint8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8Array005", 0, function () { - let proc = new util.types(); - let result = proc.isUint8Array(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_CLAMPED_ARRAY_001 - * @tc.name : testIsUint8ClampedArray001 - * @tc.desc : Check whether the entered value is the uint8clampedarray array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8ClampedArray001", 0, function () { - let proc = new util.types(); - let result = proc.isUint8ClampedArray(new Uint8ClampedArray([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_UINT8_CLAMPED_ARRAY_002 - * @tc.name : testIsUint8ClampedArray002 - * @tc.desc : Check whether the entered value is the uint8clampedarray array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8ClampedArray002", 0, function () { - let proc = new util.types(); - let result = proc.isUint8ClampedArray(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_CLAMPED_ARRAY_003 - * @tc.name : testIsUint8ClampedArray003 - * @tc.desc : Check whether the entered value is the uint8clampedarray array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8ClampedArray003", 0, function () { - let proc = new util.types(); - let result = proc.isUint8ClampedArray(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_CLAMPED_ARRAY_004 - * @tc.name : testIsUint8ClampedArray004 - * @tc.desc : Check whether the entered value is the uint8clampedarray array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8ClampedArray004", 0, function () { - let proc = new util.types(); - let result = proc.isUint8ClampedArray(new Int32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT8_CLAMPED_ARRAY_005 - * @tc.name : testIsUint8ClampedArray005 - * @tc.desc : Check whether the entered value is the uint8clampedarray array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint8ClampedArray005", 0, function () { - let proc = new util.types(); - let result = proc.isUint8ClampedArray(new Uint32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT16_ARRAY_001 - * @tc.name : testIsUint16Array001 - * @tc.desc : Check whether the entered value is the uint16array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint16Array001", 0, function () { - let proc = new util.types(); - let result = proc.isUint16Array(new Uint16Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_UINT16_ARRAY_002 - * @tc.name : testIsUint16Array002 - * @tc.desc : Check whether the entered value is the uint16array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint16Array002", 0, function () { - let proc = new util.types(); - let result = proc.isUint16Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT16_ARRAY_003 - * @tc.name : testIsUint16Array003 - * @tc.desc : Check whether the entered value is the uint16array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint16Array003", 0, function () { - let proc = new util.types(); - let result = proc.isUint16Array(new Uint32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT16_ARRAY_004 - * @tc.name : testIsUint16Array004 - * @tc.desc : Check whether the entered value is the uint16array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint16Array004", 0, function () { - let proc = new util.types(); - let result = proc.isUint16Array(new Uint8ClampedArray([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT16_ARRAY_005 - * @tc.name : testIsUint16Array005 - * @tc.desc : Check whether the entered value is the uint16array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint16Array005", 0, function () { - let proc = new util.types(); - let result = proc.isUint16Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT32_ARRAY_001 - * @tc.name : testIsUint32Array001 - * @tc.desc : Check whether the entered value is the uint32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint32Array001", 0, function () { - let proc = new util.types(); - let result = proc.isUint32Array(new Uint32Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_UINT32_ARRAY_002 - * @tc.name : testIsUint32Array002 - * @tc.desc : Check whether the entered value is the uint32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint32Array002", 0, function () { - let proc = new util.types(); - let result = proc.isUint32Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT32_ARRAY_003 - * @tc.name : testIsUint32Array003 - * @tc.desc : Check whether the entered value is the uint32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint32Array003", 0, function () { - let proc = new util.types(); - let result = proc.isUint32Array(new Uint16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT32_ARRAY_004 - * @tc.name : testIsUint32Array004 - * @tc.desc : Check whether the entered value is the uint32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint32Array004", 0, function () { - let proc = new util.types(); - let result = proc.isUint32Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_UINT32_ARRAY_005 - * @tc.name : testIsUint32Array005 - * @tc.desc : Check whether the entered value is the uint32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsUint32Array005", 0, function () { - let proc = new util.types(); - let result = proc.isUint32Array(new Uint8ClampedArray([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_MAP_001 - * @tc.name : testIsWeakMap001 - * @tc.desc : Check whether the entered value is of type weakmap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakMap001", 0, function () { - let proc = new util.types(); - let result = proc.isWeakMap(new WeakMap()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_WEAK_MAP_002 - * @tc.name : testIsWeakMap002 - * @tc.desc : Check whether the entered value is of type weakmap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakMap002", 0, function () { - let proc = new util.types(); - let result = proc.isWeakMap(new Map()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_MAP_003 - * @tc.name : testIsWeakMap003 - * @tc.desc : Check whether the entered value is of type weakmap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakMap003", 0, function () { - let proc = new util.types(); - let result = proc.isWeakMap(new Set()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_MAP_004 - * @tc.name : testIsWeakMap004 - * @tc.desc : Check whether the entered value is of type weakmap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakMap004", 0, function () { - let proc = new util.types(); - let result = proc.isWeakMap(new String()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_MAP_005 - * @tc.name : testIsWeakMap005 - * @tc.desc : Check whether the entered value is of type weakmap. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakMap005", 0, function () { - let proc = new util.types(); - let result = proc.isWeakMap(new WeakSet()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_SET_001 - * @tc.name : testIsWeakSet001 - * @tc.desc : Check whether the entered value is of type weakset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakSet001", 0, function () { - let proc = new util.types(); - let result = proc.isWeakSet(new WeakSet()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_WEAK_SET_002 - * @tc.name : testIsWeakSet002 - * @tc.desc : Check whether the entered value is of type weakset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakSet002", 0, function () { - let proc = new util.types(); - let result = proc.isWeakSet(new WeakMap()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_SET_003 - * @tc.name : testIsWeakSet003 - * @tc.desc : Check whether the entered value is of type weakset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakSet003", 0, function () { - let proc = new util.types(); - let result = proc.isWeakSet(new String()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_SET_004 - * @tc.name : testIsWeakSet004 - * @tc.desc : Check whether the entered value is of type weakset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakSet004", 0, function () { - let proc = new util.types(); - let result = proc.isWeakSet(new Set()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_WEAK_SET_005 - * @tc.name : testIsWeakSet005 - * @tc.desc : Check whether the entered value is of type weakset. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWeakSet005", 0, function () { - let proc = new util.types(); - let result = proc.isWeakSet(new Map()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NATIVE_ERROR_001 - * @tc.name : testIsNativeError001 - * @tc.desc : Check whether the value entered is of type error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNativeError001", 0, function () { - let proc = new util.types(); - let result = proc.isNativeError(new TypeError()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NATIVE_ERROR_002 - * @tc.name : testIsNativeError002 - * @tc.desc : Check whether the value entered is of type error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNativeError002", 0, function () { - let proc = new util.types(); - let result = proc.isNativeError(new Error()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NATIVE_ERROR_003 - * @tc.name : testIsNativeError003 - * @tc.desc : Check whether the value entered is of type error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNativeError003", 0, function () { - let proc = new util.types(); - let result = proc.isNativeError(new RangeError()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NATIVE_ERROR_004 - * @tc.name : testIsNativeError004 - * @tc.desc : Check whether the value entered is of type error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNativeError004", 0, function () { - let proc = new util.types(); - let result = proc.isNativeError(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NATIVE_ERROR_005 - * @tc.name : testIsNativeError005 - * @tc.desc : Check whether the value entered is of type error. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNativeError005", 0, function () { - let proc = new util.types(); - let result = proc.isNativeError(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MODULE_NAMESPACE_OBJECT_001 - * @tc.name : testIsModuleNamespaceObject001 - * @tc.desc : Check whether the entered value is the module namespace object object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsModuleNamespaceObject001", 0, function () { - let proc = new util.types(); - let result = proc.isModuleNamespaceObject(url); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MODULE_NAMESPACE_OBJECT_002 - * @tc.name : testIsModuleNamespaceObject002 - * @tc.desc : Check whether the entered value is the module namespace object object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsModuleNamespaceObject002", 0, function () { - let proc = new util.types(); - let result = proc.isModuleNamespaceObject(request); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MODULE_NAMESPACE_OBJECT_003 - * @tc.name : testIsModuleNamespaceObject003 - * @tc.desc : Check whether the entered value is the module namespace object object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsModuleNamespaceObject003", 0, function () { - let proc = new util.types(); - let result = proc.isModuleNamespaceObject(process); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MODULE_NAMESPACE_OBJECT_004 - * @tc.name : testIsModuleNamespaceObject004 - * @tc.desc : Check whether the entered value is the module namespace object object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsModuleNamespaceObject004", 0, function () { - let proc = new util.types(); - let result = proc.isModuleNamespaceObject(app); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MAP_ITERATOR_001 - * @tc.name : testIsMapIterator001 - * @tc.desc : Check whether the entered value is the iterator type of map. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMapIterator001", 0, function () { - let proc = new util.types(); - const map = new Map(); - let result = proc.isMapIterator(map.keys()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_MAP_ITERATOR_002 - * @tc.name : testIsMapIterator002 - * @tc.desc : Check whether the entered value is the iterator type of map. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMapIterator002", 0, function () { - let proc = new util.types(); - const map = new Map(); - let result = proc.isMapIterator(map.values()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_MAP_ITERATOR_003 - * @tc.name : testIsMapIterator003 - * @tc.desc : Check whether the entered value is the iterator type of map. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMapIterator003", 0, function () { - let proc = new util.types(); - const map = new Map(); - let result = proc.isMapIterator(map.entries()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_MAP_ITERATOR_004 - * @tc.name : testIsMapIterator004 - * @tc.desc : Check whether the entered value is the iterator type of map. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMapIterator004", 0, function () { - let proc = new util.types(); - const map = new Map(); - let result = proc.isMapIterator(map[Symbol.iterator]()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_MAP_ITERATOR_005 - * @tc.name : testIsMapIterator005 - * @tc.desc : Check whether the entered value is the iterator type of map. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMapIterator005", 0, function () { - let proc = new util.types(); - const map = new Map(); - let result = proc.isMapIterator(map); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MAP_001 - * @tc.name : testIsMap001 - * @tc.desc : Check whether the entered value is of map type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMap001", 0, function () { - let proc = new util.types(); - let result = proc.isMap(new Map()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_MAP_002 - * @tc.name : testIsMap002 - * @tc.desc : Check whether the entered value is of map type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMap002", 0, function () { - let proc = new util.types(); - let result = proc.isMap(new Set()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MAP_003 - * @tc.name : testIsMap003 - * @tc.desc : Check whether the entered value is of map type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMap003", 0, function () { - let proc = new util.types(); - let result = proc.isMap(new String()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MAP_004 - * @tc.name : testIsMap004 - * @tc.desc : Check whether the entered value is of map type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMap004", 0, function () { - let proc = new util.types(); - let result = proc.isMap(new Object()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_MAP_005 - * @tc.name : testIsMap005 - * @tc.desc : Check whether the entered value is of map type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsMap005", 0, function () { - let proc = new util.types(); - let result = proc.isMap(new Boolean()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT32_ARRAY_001 - * @tc.name : testIsInt32Array001 - * @tc.desc : Check whether the entered value is the int32array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt32Array001", 0, function () { - let proc = new util.types(); - let result = proc.isInt32Array(new Int32Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_INT32_ARRAY_002 - * @tc.name : testIsInt32Array002 - * @tc.desc : Check whether the entered value is the int32array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt32Array002", 0, function () { - let proc = new util.types(); - let result = proc.isInt32Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT32_ARRAY_003 - * @tc.name : testIsInt32Array003 - * @tc.desc : Check whether the entered value is the int32array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt32Array003", 0, function () { - let proc = new util.types(); - let result = proc.isInt32Array(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT32_ARRAY_004 - * @tc.name : testIsInt32Array004 - * @tc.desc : Check whether the entered value is the int32array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt32Array004", 0, function () { - let proc = new util.types(); - let result = proc.isInt32Array(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT32_ARRAY_005 - * @tc.name : testIsInt32Array005 - * @tc.desc : Check whether the entered value is the int32array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt32Array005", 0, function () { - let proc = new util.types(); - let result = proc.isInt32Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT16_ARRAY_001 - * @tc.name : testIsInt16Array001 - * @tc.desc : Check whether the entered value is the int16array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt16Array001", 0, function () { - let proc = new util.types(); - let result = proc.isInt16Array(new Int16Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_INT16_ARRAY_002 - * @tc.name : testIsInt16Array002 - * @tc.desc : Check whether the entered value is the int16array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt16Array002", 0, function () { - let proc = new util.types(); - let result = proc.isInt16Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT16_ARRAY_003 - * @tc.name : testIsInt16Array003 - * @tc.desc : Check whether the entered value is the int16array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt16Array003", 0, function () { - let proc = new util.types(); - let result = proc.isInt16Array(new Int32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT16_ARRAY_004 - * @tc.name : testIsInt16Array004 - * @tc.desc : Check whether the entered value is the int16array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt16Array004", 0, function () { - let proc = new util.types(); - let result = proc.isInt16Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT16_ARRAY_005 - * @tc.name : testIsInt16Array005 - * @tc.desc : Check whether the entered value is the int16array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt16Array005", 0, function () { - let proc = new util.types(); - let result = proc.isInt16Array(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT8_ARRAY_001 - * @tc.name : testIsInt8Array001 - * @tc.desc : Check whether the entered value is of int8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt8Array001", 0, function () { - let proc = new util.types(); - let result = proc.isInt8Array(new Int8Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_INT8_ARRAY_002 - * @tc.name : testIsInt8Array002 - * @tc.desc : Check whether the entered value is of int8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt8Array002", 0, function () { - let proc = new util.types(); - let result = proc.isInt8Array(new ArrayBuffer(0)); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT8_ARRAY_003 - * @tc.name : testIsInt8Array003 - * @tc.desc : Check whether the entered value is of int8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt8Array003", 0, function () { - let proc = new util.types(); - let result = proc.isInt8Array(new Int32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT8_ARRAY_004 - * @tc.name : testIsInt8Array004 - * @tc.desc : Check whether the entered value is of int8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt8Array004", 0, function () { - let proc = new util.types(); - let result = proc.isInt8Array(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_INT8_ARRAY_005 - * @tc.name : testIsInt8Array005 - * @tc.desc : Check whether the entered value is of int8array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsInt8Array005", 0, function () { - let proc = new util.types(); - let result = proc.isInt8Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_OBJECT_001 - * @tc.name : testIsGeneratorObject001 - * @tc.desc : Check whether the entered value is a generator object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorObject001", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorObject(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_OBJECT_002 - * @tc.name : testIsGeneratorObject002 - * @tc.desc : Check whether the entered value is a generator object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorObject002", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorObject(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_OBJECT_003 - * @tc.name : testIsGeneratorObject003 - * @tc.desc : Check whether the entered value is a generator object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorObject003", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorObject(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_OBJECT_004 - * @tc.name : testIsGeneratorObject004 - * @tc.desc : Check whether the entered value is a generator object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorObject004", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorObject(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_FUNCTION_001 - * @tc.name : testIsGeneratorFunction001 - * @tc.desc : Check whether the input value is a generator function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorFunction001", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorFunction(new Int8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_FUNCTION_002 - * @tc.name : testIsGeneratorFunction002 - * @tc.desc : Check whether the input value is a generator function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorFunction002", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorFunction(function foo() {}); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_FUNCTION_003 - * @tc.name : testIsGeneratorFunction003 - * @tc.desc : Check whether the input value is a generator function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorFunction003", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorFunction(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_GENERATOR_FUNCTION_004 - * @tc.name : testIsGeneratorFunction004 - * @tc.desc : Check whether the input value is a generator function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsGeneratorFunction004", 0, function () { - let proc = new util.types(); - let result = proc.isGeneratorFunction(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT64_ARRAY_001 - * @tc.name : testIsFloat64Array001 - * @tc.desc : Check whether the entered value is of float64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat64Array001", 0, function () { - let proc = new util.types(); - let result = proc.isFloat64Array(new Float64Array()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_FLOAT64_ARRAY_002 - * @tc.name : testIsFloat64Array002 - * @tc.desc : Check whether the entered value is of float64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat64Array002", 0, function () { - let proc = new util.types(); - let result = proc.isFloat64Array(new Int8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT64_ARRAY_003 - * @tc.name : testIsFloat64Array003 - * @tc.desc : Check whether the entered value is of float64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat64Array003", 0, function () { - let proc = new util.types(); - let result = proc.isFloat64Array(new Float32Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT64_ARRAY_004 - * @tc.name : testIsFloat64Array004 - * @tc.desc : Check whether the entered value is of float64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat64Array004", 0, function () { - let proc = new util.types(); - let result = proc.isFloat64Array(new Uint8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT64_ARRAY_005 - * @tc.name : testIsFloat64Array005 - * @tc.desc : Check whether the entered value is of float64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat64Array005", 0, function () { - let proc = new util.types(); - let result = proc.isFloat64Array(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT32_ARRAY_001 - * @tc.name : testIsFloat32Array001 - * @tc.desc : Check whether the entered value is of float32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat32Array001", 0, function () { - let proc = new util.types(); - let result = proc.isFloat32Array(new Float32Array()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_FLOAT32_ARRAY_002 - * @tc.name : testIsFloat32Array002 - * @tc.desc : Check whether the entered value is of float32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat32Array002", 0, function () { - let proc = new util.types(); - let result = proc.isFloat32Array(new Int8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT32_ARRAY_003 - * @tc.name : testIsFloat32Array003 - * @tc.desc : Check whether the entered value is of float32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat32Array003", 0, function () { - let proc = new util.types(); - let result = proc.isFloat32Array(new Int16Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT32_ARRAY_004 - * @tc.name : testIsFloat32Array004 - * @tc.desc : Check whether the entered value is of float32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat32Array004", 0, function () { - let proc = new util.types(); - let result = proc.isFloat32Array(new Float64Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FLOAT32_ARRAY_005 - * @tc.name : testIsFloat32Array005 - * @tc.desc : Check whether the entered value is of float32array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFloat32Array005", 0, function () { - let proc = new util.types(); - let result = proc.isFloat32Array(new Uint8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EXTERNAL_001 - * @tc.name : testIsExternal001 - * @tc.desc : Check whether the entered value is a native external value type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsExternal001", 0, function () { - let proc = new util.types(); - let result = proc.isExternal(new Float32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EXTERNAL_002 - * @tc.name : testIsExternal002 - * @tc.desc : Check whether the entered value is a native external value type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsExternal002", 0, function () { - let proc = new util.types(); - let result = proc.isExternal(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EXTERNAL_003 - * @tc.name : testIsExternal003 - * @tc.desc : Check whether the entered value is a native external value type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsExternal003", 0, function () { - let proc = new util.types(); - let result = proc.isExternal(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EXTERNAL_004 - * @tc.name : testIsExternal004 - * @tc.desc : Check whether the entered value is a native external value type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsExternal004", 0, function () { - let proc = new util.types(); - let result = proc.isExternal(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_EXTERNAL_005 - * @tc.name : testIsExternal005 - * @tc.desc : Check whether the entered value is a native external value type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsExternal005", 0, function () { - let proc = new util.types(); - let result = proc.isExternal(new Int16Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATE_001 - * @tc.name : testIsDate001 - * @tc.desc : Check whether the entered value is of type date. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDate001", 0, function () { - let proc = new util.types(); - let result = proc.isDate(new Date()); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_DATE_002 - * @tc.name : testIsDate002 - * @tc.desc : Check whether the entered value is of type date. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDate002", 0, function () { - let proc = new util.types(); - let result = proc.isDate(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATE_003 - * @tc.name : testIsDate003 - * @tc.desc : Check whether the entered value is of type date. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDate003", 0, function () { - let proc = new util.types(); - let result = proc.isDate(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATE_004 - * @tc.name : testIsDate004 - * @tc.desc : Check whether the entered value is of type date. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDate004", 0, function () { - let proc = new util.types(); - let result = proc.isDate(new Int16Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATE_005 - * @tc.name : testIsDate005 - * @tc.desc : Check whether the entered value is of type date. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDate005", 0, function () { - let proc = new util.types(); - let result = proc.isDate(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATA_VIEW_001 - * @tc.name : testIsDataView001 - * @tc.desc : Check whether the entered value is of DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDataView001", 0, function () { - let proc = new util.types(); - const ab = new ArrayBuffer(20); - let result = proc.isDataView(new DataView(ab)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_DATA_VIEW_002 - * @tc.name : testIsDataView002 - * @tc.desc : Check whether the entered value is of DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDataView002", 0, function () { - let proc = new util.types(); - let result = proc.isDataView(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATA_VIEW_003 - * @tc.name : testIsDataView003 - * @tc.desc : Check whether the entered value is of DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDataView003", 0, function () { - let proc = new util.types(); - let result = proc.isDataView(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATA_VIEW_004 - * @tc.name : testIsDataView004 - * @tc.desc : Check whether the entered value is of DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDataView004", 0, function () { - let proc = new util.types(); - let result = proc.isDataView(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_DATA_VIEW_005 - * @tc.name : testIsDataView005 - * @tc.desc : Check whether the entered value is of DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsDataView005", 0, function () { - let proc = new util.types(); - let result = proc.isDataView(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BOXED_PRIMITIVE_001 - * @tc.name : testIsBoxedPrimitive001 - * @tc.desc : Check whether the entered value is a Boolean or number or string or symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBoxedPrimitive001", 0, function () { - let proc = new util.types(); - let result = proc.isBoxedPrimitive(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BOXED_PRIMITIVE_002 - * @tc.name : testIsBoxedPrimitive002 - * @tc.desc : Check whether the entered value is a Boolean or number or string or symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBoxedPrimitive002", 0, function () { - let proc = new util.types(); - let result = proc.isBoxedPrimitive(new Boolean(false)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BOXED_PRIMITIVE_003 - * @tc.name : testIsBoxedPrimitive003 - * @tc.desc : Check whether the entered value is a Boolean or number or string or symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBoxedPrimitive003", 0, function () { - let proc = new util.types(); - let result = proc.isBoxedPrimitive(Symbol("foo")); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BOXED_PRIMITIVE_004 - * @tc.name : testIsBoxedPrimitive004 - * @tc.desc : Check whether the entered value is a Boolean or number or string or symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBoxedPrimitive004", 0, function () { - let proc = new util.types(); - let result = proc.isBoxedPrimitive(Object(Symbol("foo"))); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BOXED_PRIMITIVE_005 - * @tc.name : testIsBoxedPrimitive005 - * @tc.desc : Check whether the entered value is a Boolean or number or string or symbol object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBoxedPrimitive005", 0, function () { - let proc = new util.types(); - let result = proc.isBoxedPrimitive(new Boolean(true)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BOOLEAN_OBJECT_001 - * @tc.name : testIsBooleanObject001 - * @tc.desc : Check whether the entered value is a Boolean object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBooleanObject001", 0, function () { - let proc = new util.types(); - let result = proc.isBooleanObject(new Boolean(false)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BOOLEAN_OBJECT_002 - * @tc.name : testIsBooleanObject002 - * @tc.desc : Check whether the entered value is a Boolean object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBooleanObject002", 0, function () { - let proc = new util.types(); - let result = proc.isBooleanObject(new Boolean(true)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BOOLEAN_OBJECT_003 - * @tc.name : testIsBooleanObject003 - * @tc.desc : Check whether the entered value is a Boolean object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBooleanObject003", 0, function () { - let proc = new util.types(); - let result = proc.isBooleanObject(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BOOLEAN_OBJECT_004 - * @tc.name : testIsBooleanObject004 - * @tc.desc : Check whether the entered value is a Boolean object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBooleanObject004", 0, function () { - let proc = new util.types(); - let result = proc.isBooleanObject(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BOOLEAN_OBJECT_005 - * @tc.name : testIsBooleanObject005 - * @tc.desc : Check whether the entered value is a Boolean object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBooleanObject005", 0, function () { - let proc = new util.types(); - let result = proc.isBooleanObject(Boolean(true)); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_UINT64_ARRAY_001 - * @tc.name : testIsBigUint64Array001 - * @tc.desc : Check whether the entered value is of biguint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigUint64Array001", 0, function () { - let proc = new util.types(); - let result = proc.isBigUint64Array(new BigUint64Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BIG_UINT64_ARRAY_002 - * @tc.name : testIsBigUint64Array002 - * @tc.desc : Check whether the entered value is of biguint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigUint64Array002", 0, function () { - let proc = new util.types(); - let result = proc.isBigUint64Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_UINT64_ARRAY_003 - * @tc.name : testIsBigUint64Array003 - * @tc.desc : Check whether the entered value is of biguint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigUint64Array003", 0, function () { - let proc = new util.types(); - let result = proc.isBigUint64Array(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_UINT64_ARRAY_004 - * @tc.name : testIsBigUint64Array004 - * @tc.desc : Check whether the entered value is of biguint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigUint64Array004", 0, function () { - let proc = new util.types(); - let result = proc.isBigUint64Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_UINT64_ARRAY_005 - * @tc.name : testIsBigUint64Array005 - * @tc.desc : Check whether the entered value is of biguint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigUint64Array005", 0, function () { - let proc = new util.types(); - let result = proc.isBigUint64Array(new BigInt64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_INT64_ARRAY_001 - * @tc.name : testIsBigInt64Array001 - * @tc.desc : Check whether the entered value is of bigint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigInt64Array001", 0, function () { - let proc = new util.types(); - let result = proc.isBigInt64Array(new BigInt64Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_BIG_INT64_ARRAY_002 - * @tc.name : testIsBigInt64Array002 - * @tc.desc : Check whether the entered value is of bigint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigInt64Array002", 0, function () { - let proc = new util.types(); - let result = proc.isBigInt64Array(new Int32Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_INT64_ARRAY_003 - * @tc.name : testIsBigInt64Array003 - * @tc.desc : Check whether the entered value is of bigint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigInt64Array003", 0, function () { - let proc = new util.types(); - let result = proc.isBigInt64Array(new Uint8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_INT64_ARRAY_004 - * @tc.name : testIsBigInt64Array004 - * @tc.desc : Check whether the entered value is of bigint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigInt64Array004", 0, function () { - let proc = new util.types(); - let result = proc.isBigInt64Array(new Float64Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_BIG_INT64_ARRAY_005 - * @tc.name : testIsBigInt64Array005 - * @tc.desc : Check whether the entered value is of bigint64array array type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsBigInt64Array005", 0, function () { - let proc = new util.types(); - let result = proc.isBigInt64Array(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ASYNC_FUNCTION_001 - * @tc.name : testIsAsyncFunction001 - * @tc.desc : Check whether the value entered is an asynchronous function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAsyncFunction001", 0, function () { - let proc = new util.types(); - let result = proc.isAsyncFunction(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ASYNC_FUNCTION_002 - * @tc.name : testIsAsyncFunction002 - * @tc.desc : Check whether the value entered is an asynchronous function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAsyncFunction002", 0, function () { - let proc = new util.types(); - let result = proc.isAsyncFunction(function foo() {}); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ASYNC_FUNCTION_003 - * @tc.name : testIsAsyncFunction003 - * @tc.desc : Check whether the value entered is an asynchronous function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAsyncFunction003", 0, function () { - let proc = new util.types(); - let result = proc.isAsyncFunction(new Int8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ASYNC_FUNCTION_004 - * @tc.name : testIsAsyncFunction004 - * @tc.desc : Check whether the value entered is an asynchronous function type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAsyncFunction004", 0, function () { - let proc = new util.types(); - let result = proc.isAsyncFunction(async function foo() {}); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_001 - * @tc.name : testIsArrayBuffer001 - * @tc.desc : Check whether the entered value is of arraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBuffer001", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBuffer(new ArrayBuffer(0)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_002 - * @tc.name : testIsArrayBuffer002 - * @tc.desc : Check whether the entered value is of arraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBuffer002", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBuffer(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_003 - * @tc.name : testIsArrayBuffer003 - * @tc.desc : Check whether the entered value is of arraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBuffer003", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBuffer(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_004 - * @tc.name : testIsArrayBuffer004 - * @tc.desc : Check whether the entered value is of arraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBuffer004", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBuffer(new Int8Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_005 - * @tc.name : testIsArrayBuffer005 - * @tc.desc : Check whether the entered value is of arraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBuffer005", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBuffer(new Int16Array()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARGUMENTS_OBJECT_001 - * @tc.name : testIsArgumentsObject001 - * @tc.desc : Check whether the entered value is an arguments object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArgumentsObject001", 0, function () { - let proc = new util.types(); - function foo() { - let result = proc.isArgumentsObject(arguments); - expect(result).assertEqual(true); - } - let f = foo(); - }); - - /** - * @tc.number: TEST_IS_ARGUMENTS_OBJECT_002 - * @tc.name : testIsArgumentsObject002 - * @tc.desc : Check whether the entered value is an arguments object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArgumentsObject002", 0, function () { - let proc = new util.types(); - let result = proc.isArgumentsObject(new Int8Array([])); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARGUMENTS_OBJECT_003 - * @tc.name : testIsArgumentsObject003 - * @tc.desc : Check whether the entered value is an arguments object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArgumentsObject003", 0, function () { - let proc = new util.types(); - let result = proc.isArgumentsObject(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARGUMENTS_OBJECT_004 - * @tc.name : testIsArgumentsObject004 - * @tc.desc : Check whether the entered value is an arguments object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArgumentsObject004", 0, function () { - let proc = new util.types(); - let result = proc.isArgumentsObject(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARGUMENTS_OBJECT_005 - * @tc.name : testIsArgumentsObject005 - * @tc.desc : Check whether the entered value is an arguments object type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArgumentsObject005", 0, function () { - let proc = new util.types(); - let result = proc.isArgumentsObject(new Boolean()); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_VIEW_001 - * @tc.name : testIsArrayBufferView001 - * @tc.desc : Check whether the entered value is napi_ int8_ array or napi_ uint8_ array - or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ - uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBufferView001", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBufferView(new Int8Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_VIEW_002 - * @tc.name : testIsArrayBufferView002 - * @tc.desc : Check whether the entered value is napi_ int8_ array or napi_ uint8_ array - or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ - uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBufferView002", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBufferView(new Int32Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_VIEW_003 - * @tc.name : testIsArrayBufferView003 - * @tc.desc : Check whether the entered value is napi_ int8_ array or napi_ uint8_ array - or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ - uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBufferView003", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBufferView(new DataView(new ArrayBuffer(16))); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_VIEW_004 - * @tc.name : testIsArrayBufferView004 - * @tc.desc : Check whether the entered value is napi_ int8_ array or napi_ uint8_ array - or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ - uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBufferView004", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBufferView(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ARRAY_BUFFER_VIEW_005 - * @tc.name : testIsArrayBufferView005 - * @tc.desc : Check whether the entered value is napi_ int8_ array or napi_ uint8_ array - or naPi_ uint8_ clamped_ array or naPi_ int16_ array or naPi_ uint16_ array or napi_ int32_ array or napi_ - uint32_ array or napi_ float32_ array or napi_ float64_ array array or DataView type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsArrayBufferView005", 0, function () { - let proc = new util.types(); - let result = proc.isArrayBufferView(new Int16Array([])); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ANY_ARRAY_BUFFER_001 - * @tc.name : testIsAnyArrayBuffer001 - * @tc.desc : Check whether the entered value is of anyarraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAnyArrayBuffer001", 0, function () { - let proc = new util.types(); - let result = proc.isAnyArrayBuffer(new ArrayBuffer(0)); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ANY_ARRAY_BUFFER_002 - * @tc.name : testIsAnyArrayBuffer002 - * @tc.desc : Check whether the entered value is of anyarraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAnyArrayBuffer002", 0, function () { - let proc = new util.types(); - let result = proc.isAnyArrayBuffer(true); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ANY_ARRAY_BUFFER_003 - * @tc.name : testIsAnyArrayBuffer003 - * @tc.desc : Check whether the entered value is of anyarraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAnyArrayBuffer003", 0, function () { - let proc = new util.types(); - let result = proc.isAnyArrayBuffer(false); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ANY_ARRAY_BUFFER_004 - * @tc.name : testIsAnyArrayBuffer004 - * @tc.desc : Check whether the entered value is of anyarraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAnyArrayBuffer004", 0, function () { - let proc = new util.types(); - let buf = new ArrayBuffer(10); - let result = proc.isAnyArrayBuffer(buf); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ANY_ARRAY_BUFFER_005 - * @tc.name : testIsAnyArrayBuffer005 - * @tc.desc : Check whether the entered value is of anyarraybuffer type. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsAnyArrayBuffer005", 0, function () { - let proc = new util.types(); - let result = proc.isAnyArrayBuffer(new Boolean(false)); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_UTIL_FORMAT_001 - * @tc.name : testUtilFormat001 - * @tc.desc : Returns the formatted string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilFormat001", 0, function () { - let format = "%i,%s"; - let value1 = 1.5; - let value2 = "qwer"; - let value3 = 15; - let result = util.format(format, value1, value2, value3); - expect(result).assertEqual("1,qwer 15"); - }); - - /** - * @tc.number: TEST_UTIL_FORMAT_002 - * @tc.name : testUtilFormat002 - * @tc.desc : Returns the formatted string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilFormat002", 0, function () { - let format = "%O"; - let value = { name: "jack", age: 15 }; - let result = util.format(format, value); - expect(result).assertEqual("{ name: 'jack',\n age: 15 }"); - }); - - /** - * @tc.number: TEST_UTIL_FORMAT_003 - * @tc.name : testUtilFormat003 - * @tc.desc : Returns the formatted string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilFormat003", 0, function () { - let format = "%o"; - let value = [1, 2, 3]; - let result = util.format(format, value); - expect(result).assertEqual("[ 1, 2, 3, [length]: 3 ]"); - }); - - /** - * @tc.number: TEST_UTIL_FORMAT_004 - * @tc.name : testUtilFormat004 - * @tc.desc : Returns the formatted string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilFormat004", 0, function () { - let format = "%s,%s,%s"; - let value1 = "1.5"; - let value2 = "qwer"; - let result = util.format(format, value1, value2); - expect(result).assertEqual("1.5,qwer,%s"); - }); - - /** - * @tc.number: TEST_UTIL_FORMAT_005 - * @tc.name : testUtilFormat005 - * @tc.desc : Returns the formatted string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilFormat005", 0, function () { - let format = "%d,%d"; - let value1 = 6; - let value2 = 16; - let result = util.format(format, value1, value2); - expect(result).assertEqual("6,16"); - }); - - /** - * @tc.number: TEST_UTIL_ERR_NO_TO_STRING_001 - * @tc.name : testUtilErrNoToString001 - * @tc.desc : Get the string name of the system errno. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilErrNoToString001", 0, async function () { - let errnum = 10; - let result = util.errnoToString(errnum); - expect(result).assertEqual("Unknown system error 10"); - }); - - /** - * @tc.number: TEST_UTIL_ERR_NO_TO_STRING_002 - * @tc.name : testUtilErrNoToString002 - * @tc.desc : Get the string name of the system errno. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilErrNoToString002", 0, async function () { - let errnum = 0; - let result = util.errnoToString(errnum); - expect(result).assertEqual("Unknown system error 0"); - }); - - /** - * @tc.number: TEST_UTIL_ERR_NO_TO_STRING_003 - * @tc.name : testUtilErrNoToString003 - * @tc.desc : Get the string name of the system errno. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilErrNoToString003", 0, async function () { - let errnum = -1; - let result = util.errnoToString(errnum); - expect(result).assertEqual("operation not permitted"); - }); - - /** - * @tc.number: TEST_UTIL_ERR_NO_TO_STRING_004 - * @tc.name : testUtilErrNoToString004 - * @tc.desc : Get the string name of the system errno. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilErrNoToString004", 0, async function () { - let errnum = 9; - let result = util.errnoToString(errnum); - expect(result).assertEqual("Unknown system error 9"); - }); - - /** - * @tc.number: TEST_UTIL_ERR_NO_TO_STRING_005 - * @tc.name : testUtilErrNoToString005 - * @tc.desc : Get the string name of the system errno. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilErrNoToString005", 0, async function () { - let errnum = 555; - let result = util.errnoToString(errnum); - expect(result).assertEqual("Unknown system error 555"); - }); - - /** - * @tc.number: TEST_UTIL_CALLBACK_WRAPPER_001 - * @tc.name : testUtilCallbackWrapper001 - * @tc.desc : Takes an async function (or a function that returns a Promise) and - returns a function following the error-first callback style. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilCallbackWrapper001", 0, async function () { - async function promiseFn() { - return Promise.resolve("value"); - } - let cb = util.callbackWrapper(promiseFn); - cb(1, (err, ret) => { - expect(err).assertEqual(null); - expect(ret).assertEqual("value"); - }); - }); - - /** - * @tc.number: TEST_UTIL_CALLBACK_WRAPPER_002 - * @tc.name : testUtilCallbackWrapper002 - * @tc.desc : Takes an async function (or a function that returns a Promise) and - returns a function following the error-first callback style. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilCallbackWrapper002", 0, async function () { - async function promiseFn() { - return 42; - } - let cb = util.callbackWrapper(promiseFn); - cb(1, (err, ret) => { - expect(err).assertEqual(null); - expect(ret).assertEqual(42); - }); - }); - - /** - * @tc.number: TEST_UTIL_CALLBACK_WRAPPER_003 - * @tc.name : testUtilCallbackWrapper003 - * @tc.desc : Takes an async function (or a function that returns a Promise) and - returns a function following the error-first callback style. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilCallbackWrapper003", 0, async function () { - async function promiseFn() { - let err = Error("value"); - return Promise.reject(err); - } - let cb = util.callbackWrapper(promiseFn); - cb(1, (err, ret) => { - expect(err.message === "value").assertTrue(); - expect(ret).assertEqual(undefined); - }); - }); - - /** - * @tc.number: TEST_UTIL_CALLBACK_WRAPPER_004 - * @tc.name : testUtilCallbackWrapper004 - * @tc.desc : Takes an async function (or a function that returns a Promise) and - returns a function following the error-first callback style. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilCallbackWrapper004", 0, async function () { - async function promiseFn(args) { - const [a, b] = args; - return a + b; - } - let cb = util.callbackWrapper(promiseFn); - cb([1, 2], (err, ret) => { - expect(err).assertEqual(null); - expect(ret).assertEqual(3); - }); - }); - - /** - * @tc.number: TEST_UTIL_CALLBACK_WRAPPER_005 - * @tc.name : testUtilCallbackWrapper005 - * @tc.desc : Takes an async function (or a function that returns a Promise) and - returns a function following the error-first callback style. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilCallbackWrapper005", 0, async function () { - async function promiseFn() { - return null; - } - let cb = util.callbackWrapper(promiseFn); - try { - cb(1, [1, 2]); - expect(0).assertEqual(1); - } catch (err) { - expect(err.message).assertEqual("maybe is not function"); - } - }); - - /** - * @tc.number: TEST_UTIL_PROMISIFY_001 - * @tc.name : testUtilPromisify001 - * @tc.desc : Takes a function following the common error-first callback style, - taking an callback as the last argument, and return a function that returns promises. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilPromisify001", 0, async function () { - function fn(val, callback) { - if (typeof val === "string") { - callback(null, val); - } else { - callback("type err"); - } - } - let value = util.promisify(fn); - const result = await value("Hello"); - expect(result[0] == "Hello").assertTrue(); - }); - - /** - * @tc.number: TEST_UTIL_PROMISIFY_002 - * @tc.name : testUtilPromisify002 - * @tc.desc : Takes a function following the common error-first callback style, - taking an callback as the last argument, and return a function that returns promises. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilPromisify002", 0, async function () { - function fn(str, callback) { - if (typeof str === "string") { - callback(null, str); - } else { - callback(null, "type err"); - } - } - let value = util.promisify(fn); - const result = await value(123); - expect(result[0] == "type err").assertTrue(); - }); - - /** - * @tc.number: TEST_UTIL_PROMISIFY_003 - * @tc.name : testUtilPromisify003 - * @tc.desc : Takes a function following the common error-first callback style, - taking an callback as the last argument, and return a function that returns promises. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilPromisify003", 0, async function () { - function fn(val, callback) { - callback(null, val); - } - let value = util.promisify(fn); - const result = await value(42); - expect(result[0] == 42).assertTrue(); - }); - - /** - * @tc.number: TEST_UTIL_PROMISIFY_004 - * @tc.name : testUtilPromisify004 - * @tc.desc : Takes a function following the common error-first callback style, - taking an callback as the last argument, and return a function that returns promises. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilPromisify004", 0, async function () { - function fn(val, callback) { - if (typeof val === "boolean") { - callback(null, val); - } else { - callback("type err"); - } - } - let value = util.promisify(fn); - const result = await value(false); - expect(result[0] == false).assertTrue(); - }); - - /** - * @tc.number: TEST_UTIL_PROMISIFY_005 - * @tc.name : testUtilPromisify005 - * @tc.desc : Takes a function following the common error-first callback style, - taking an callback as the last argument, and return a function that returns promises. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilPromisify005", 0, async function () { - function fn(val, callback) { - if (typeof val === "number") { - callback(null, val); - } else { - callback("type err"); - } - } - let value = util.promisify(fn); - const result = await value(100); - expect(result[0] == 100).assertTrue(); - }); - - /** - * @tc.number: TEST_UTIL_GENERATE_RANDOM_UUID_001 - * @tc.name : testUtilGenerateRandomUUID001 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilGenerateRandomUUID001", 0, async function () { - let result = util.generateRandomUUID(true); - expect(result.length).assertEqual(36); - }); - - /** - * @tc.number: TEST_UTIL_GENERATE_RANDOM_UUID_002 - * @tc.name : testUtilGenerateRandomUUID002 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilGenerateRandomUUID002", 0, async function () { - let result = util.generateRandomUUID(false); - expect(result.length).assertEqual(36); - }); - - /** - * @tc.number: TEST_UTIL_GENERATE_RANDOM_BINARY_UUID_001 - * @tc.name : testUtilGenerateRandomBinaryUUID001 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilGenerateRandomBinaryUUID001", 0, async function () { - let result = util.generateRandomBinaryUUID(true); - expect(result.length).assertEqual(16); - }); - - /** - * @tc.number: TEST_UTIL_GENERATE_RANDOM_BINARY_UUID_002 - * @tc.name : testUtilGenerateRandomBinaryUUID002 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilgenerateRandomBinaryUUID002", 0, async function () { - let result = util.generateRandomBinaryUUID(false); - expect(result.length).assertEqual(16); - }); - - /** - * @tc.number: TEST_UTIL_PARSE_UUID_001 - * @tc.name : testUtilParseUUID001 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilParseUUID001", 0, async function () { - let result = util.parseUUID("84bdf796-66cc-4655-9b89-d6218d100f9c"); - expect(result.length).assertEqual(16); - }); - - /** - * @tc.number: TEST_UTIL_PARSE_UUID_002 - * @tc.name : testUtilParseUUID002 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilParseUUID002", 0, async function () { - try { - let result = util.parseUUID("84df796-66cc-4655-9b89-d6218d100f9c"); - expect(0).assertEqual(1); - } catch (e) { - expect(e.message).assertEqual("Syntax Error.Invalid 84df796-66cc-4655-9b89-d6218d100f9c string"); - } - }); - - /** - * @tc.number: TEST_UTIL_PARSE_UUID_003 - * @tc.name : testUtilParseUUID003 - * @tc.desc : Generate a random RFC 4122 version 4 UUID. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testUtilParseUUID003", 0, async function () { - try { - let result = util.parseUUID("84Wdf796-66cc-4655-9b89-d6218d100f9c"); - expect(0).assertEqual(1); - } catch (e) { - expect(e.message).assertEqual("Syntax Error.Invalid 84Wdf796-66cc-4655-9b89-d6218d100f9c string"); - } - }); - - /** - * @tc.number: TEST_ENCODING_TEXT_DECODER_001 - * @tc.name : testEncodingTextDecoder001 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodingTextDecoder001", 0, function () { - let that = util.TextDecoder.create("utf-8", { ignoreBOM: true }); - let retStr = that.encoding; - expect(retStr).assertEqual("utf-8"); - }); - - /** - * @tc.number: TEST_FATAL_001 - * @tc.name : testFatal001 - * @tc.desc : Returns `true` if error mode is "fatal", and `false` otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testFatal001", 0, function () { - let that = util.TextDecoder.create("utf-16be", { fatal: true }); - let fatalStr = that.fatal; - expect(fatalStr).assertEqual(true); - }); - - /** - * @tc.number: TEST_IGNORE_BOM_001 - * @tc.name : testIgnoreBom001 - * @tc.desc : Returns `true` if ignore BOM flag is set, and `false` otherwise. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIgnoreBOM001", 0, function () { - let that = util.TextDecoder.create("utf-16be", { ignoreBOM: true }); - let ignoreBOMStr = that.ignoreBOM; - expect(ignoreBOMStr).assertEqual(true); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Check if the constructor of TextDecoder has been called. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let that = new util.TextDecoder(); - expect(that != null).assertTrue(); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_001 - * @tc.name : testTextDecoderCreate001 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate001", 0, function () { - let that = util.TextDecoder.create("utf-8", { ignoreBOM: true }); - let retStr = that.encoding; - expect(retStr).assertEqual("utf-8"); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_002 - * @tc.name : testTextDecoderCreate002 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate002", 0, function () { - let that = util.TextDecoder.create("utf-16le"); - let encodingStr = that.encoding; - expect(encodingStr).assertEqual("utf-16le"); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_003 - * @tc.name : testTextDecoderCreate003 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate003", 0, function () { - let that = util.TextDecoder.create("utf-16be", { ignoreBOM: true }); - let encodingStr = that.encoding; - expect(encodingStr).assertEqual("utf-16be"); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_004 - * @tc.name : testTextDecoderCreate004 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate004", 0, function () { - let that = util.TextDecoder.create("utf-16be", { ignoreBOM: false }); - let encodingStr = that.encoding; - expect(encodingStr).assertEqual("utf-16be"); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_005 - * @tc.name : testTextDecoderCreate005 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate005", 0, function () { - let that = util.TextDecoder.create(); - let encodingStr = that.encoding; - expect(encodingStr).assertEqual("utf-8"); - }); - - /** - * @tc.number: TEST_TEXT_DECODER_CREATE_006 - * @tc.name : testTextDecoderCreate006 - * @tc.desc : The source encoding's name, lowercased. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testTextDecoderCreate006", 0, function () { - let that = util.TextDecoder.create("utf-8", { ignoreBOM: false }); - let encodingStr = that.encoding; - expect(encodingStr).assertEqual("utf-8"); - }); - - /** - * @tc.number: TEST_DECODER_WITH_STREAM_001 - * @tc.name : testDecodeWithStream001 - * @tc.desc : Decode the input parameters and output the corresponding text. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeWithStream001", 0, function () { - let that = util.TextDecoder.create("utf-16le", { ignoreBOM: false }); - let arr = new Uint8Array(8); - arr[0] = 0xff; - arr[1] = 0xfe; - arr[2] = 0x61; - arr[3] = 0x00; - arr[4] = 0x62; - arr[5] = 0x00; - arr[6] = 0x63; - arr[7] = 0x00; - let retStr = that.decodeWithStream(arr, { stream: false }); - let BOM = "\uFEFF"; - let rel = "abc"; - let re = BOM + rel; - expect(retStr).assertEqual(re); - }); - - /** - * @tc.number: TEST_DECODER_WITH_STREAM_002 - * @tc.name : testDecodeWithStream002 - * @tc.desc : Decode the input parameters and output the corresponding text. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeWithStream002", 0, function () { - let that = util.TextDecoder.create("utf-8", { ignoreBOM: true }); - let arr = new Uint8Array(6); - arr[0] = 0xef; - arr[1] = 0xbb; - arr[2] = 0xbf; - arr[3] = 0x61; - arr[4] = 0x62; - arr[5] = 0x63; - let retStr = that.decodeWithStream(arr, { stream: true }); - let BOM = "\uFEFF"; - let rel = "abc"; - let re = BOM + rel; - expect(retStr).assertEqual(re); - }); - - /** - * @tc.number: TEST_DECODER_WITH_STREAM_003 - * @tc.name : testDecodeWithStream003 - * @tc.desc : Decode the input parameters and output the corresponding text. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeWithStream003", 0, function () { - let that = util.TextDecoder.create("utf-16be"); - let arr = new Uint8Array(6); - arr[0] = 0x00; - arr[1] = 0x61; - arr[2] = 0x00; - arr[3] = 0x62; - arr[4] = 0x00; - arr[5] = 0x63; - let retStr = that.decodeWithStream(arr); - let rel = "abc"; - expect(retStr).assertEqual(rel); - }); - - /** - * @tc.number: TEST_DECODER_WITH_STREAM_004 - * @tc.name : testDecodeWithStream004 - * @tc.desc : Decode the input parameters and output the corresponding text. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeWithStream004", 0, function () { - let that = util.TextDecoder.create("utf-16le"); - let arr = new Uint8Array(6); - arr[0] = 0x61; - arr[1] = 0x00; - arr[2] = 0x62; - arr[3] = 0x00; - arr[4] = 0x63; - arr[5] = 0x00; - let retStr = that.decodeWithStream(arr); - let rel = "abc"; - expect(retStr).assertEqual(rel); - }); - - /** - * @tc.number: TEST_DECODER_WITH_STREAM_005 - * @tc.name : testDecodeWithStream005 - * @tc.desc : Decode the input parameters and output the corresponding text. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeWithStream005", 0, function () { - let that = util.TextDecoder.create("utf-8"); - let arr = new Uint8Array(3); - for (let i = 0; i < 3; i++) { - arr[i] = 0x61 + i; - } - let retStr = that.decodeWithStream(arr); - let rel = "abc"; - expect(retStr).assertEqual(rel); - }); - - /** - * @tc.number: TEST_ENCODING_TEXT_ENCODER_001 - * @tc.name : testEncodingTextEncoder001 - * @tc.desc : Encoding format. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodingTextEncoder001", 0, function () { - let that = new util.TextEncoder(); - let str = that.encoding; - expect(str).assertEqual("utf-8"); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_001 - * @tc.name : testEncodeInto001 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto001", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("abc"); - expect(result[0]).assertEqual(0x61); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_002 - * @tc.name : testEncodeInto002 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto002", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("\uD800楼楼"); - expect(result[5]).assertEqual(188); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_003 - * @tc.name : testEncodeInto003 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto003", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("a\uD800楼楼"); - expect(result[0]).assertEqual(0x61); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_004 - * @tc.name : testEncodeInto004 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto004", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("abc\uD800楼楼"); - expect(result[1]).assertEqual(0x62); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_005 - * @tc.name : testEncodeInto005 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto005", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("123\uD800楼楼"); - expect(result[0]).assertEqual(49); - expect(result[9]).assertEqual(230); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_006 - * @tc.name : testEncodeInto006 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto006", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("123¥\uD800楼"); - expect(result[10]).assertEqual(0xbc); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_007 - * @tc.name : testEncodeInto007 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto007", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("¥¥"); - expect(result[0]).assertEqual(0xc2); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_008 - * @tc.name : testEncodeInto008 - * @tc.desc : Returns the result of encoder. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto008", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("$$"); - expect(result[0]).assertEqual(0x24); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_009 - * @tc.name : testEncodeInto009 - * @tc.desc : Returns the result of encoder for gb18030. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto009", 0, function () { - let that1 = new util.TextEncoder('gb18030'); - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("abcde"); - expect(that1 != null).assertTrue(); - expect(result[0]).assertEqual(97); - expect(result[1]).assertEqual(98); - expect(result[2]).assertEqual(99); - expect(result[3]).assertEqual(100); - expect(result[4]).assertEqual(101); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_010 - * @tc.name : testEncodeInto010 - * @tc.desc : Returns the result of encoder for GB18030. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeInto010", 0, function () { - let that1 = new util.TextEncoder('GB18030'); - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let result = new Uint8Array(buffer); - result = that.encodeInto("abcde"); - expect(that1 != null).assertTrue(); - expect(result[0]).assertEqual(97); - expect(result[1]).assertEqual(98); - expect(result[2]).assertEqual(99); - expect(result[3]).assertEqual(100); - expect(result[4]).assertEqual(101); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_001 - * @tc.name : testEncodeIntoUint8Array001 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array001", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let dest = new Uint8Array(buffer, 0, 13); - let result = new Object(); - result = that.encodeIntoUint8Array("\uD800A\uDF06A楼HiA", dest); - expect(result["read"]).assertEqual(7); - expect(result["written"]).assertEqual(13); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_002 - * @tc.name : testEncodeIntoUint8Array002 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array002", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(6); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("abc\u2603d", dest); - expect(result["read"]).assertEqual(4); - expect(result["written"]).assertEqual(6); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_003 - * @tc.name : testEncodeIntoUint8Array003 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array003", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(4); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("abcd", dest); - expect(result["read"]).assertEqual(4); - expect(result["written"]).assertEqual(4); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_004 - * @tc.name : testEncodeIntoUint8Array004 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array004", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(4); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("12345", dest); - expect(result["read"]).assertEqual(4); - expect(result["written"]).assertEqual(4); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_005 - * @tc.name : testEncodeIntoUint8Array005 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array005", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(4); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("123 4*!@#", dest); - expect(result["read"]).assertEqual(4); - expect(result["written"]).assertEqual(4); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_006 - * @tc.name : testEncodeIntoUint8Array006 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array006", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(4); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("", dest); - expect(result["read"]).assertEqual(0); - expect(result["written"]).assertEqual(0); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_007 - * @tc.name : testEncodeIntoUint8Array007 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array007", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let dest = new Uint8Array(buffer); - let result = new Object(); - result = that.encodeIntoUint8Array("12ab", dest); - expect(result["read"]).assertEqual(4); - expect(result["written"]).assertEqual(4); - }); - - /** - * @tc.number: TEST_ENCODE_INTO_UINT_8_ARRAY_008 - * @tc.name : testEncodeIntoUint8Array008 - * @tc.desc : encode string, write the result to dest array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeIntoUint8Array008", 0, function () { - let that = new util.TextEncoder(); - let buffer = new ArrayBuffer(20); - let dest = new Uint8Array(buffer, 0, 0); - let result = new Object(); - result = that.encodeIntoUint8Array("\uD800A\uDF06A楼HiA", dest); - expect(result["read"]).assertEqual(0); - expect(result["written"]).assertEqual(0); - }); - - /** - * @tc.number: TEST_PARSE_Rational_NUMBER_001 - * @tc.name : testParseRationalNumber001 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParseRationalNumber001", 0, function () { - let res = util.RationalNumber.parseRationalNumber(2, 1); - let result = res.valueOf(); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_CREATE_Rational_FROM_STRING_001 - * @tc.name : testCreateRationalFromString001 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCreateRationalFromString001", 0, function () { - let res = util.RationalNumber.createRationalFromString("-1:2"); - let result = res.valueOf(); - expect(result).assertEqual(-0.5); - }); - - /** - * @tc.number: TEST_CREATE_Rational_FROM_STRING_002 - * @tc.name : testCreateRationalFromString002 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCreateRationalFromString002", 0, function () { - let res = util.RationalNumber.createRationalFromString("+3/4"); - let result = res.valueOf(); - expect(result).assertEqual(0.75); - }); - - /** - * @tc.number: TEST_CREATE_Rational_FROM_STRING_003 - * @tc.name : testCreateRationalFromString003 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCreateRationalFromString003", 0, function () { - let res = util.RationalNumber.createRationalFromString("+3:-4"); - let result = res.valueOf(); - expect(result).assertEqual(-0.75); - }); - - /** - * @tc.number: TEST_CREATE_Rational_FROM_STRING_004 - * @tc.name : testCreateRationalFromString004 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCreateRationalFromString004", 0, function () { - let res = util.RationalNumber.createRationalFromString("+2:4"); - let result = res.valueOf(); - expect(result).assertEqual(0.5); - }); - - /** - * @tc.number: TEST_CREATE_Rational_FROM_STRING_004 - * @tc.name : testCreateRationalFromString004 - * @tc.desc : Creates a RationalNumber object based on a given string. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCreateRationalFromString005", 0, function () { - let res = util.RationalNumber.createRationalFromString("+2:-4"); - let result = res.valueOf(); - expect(result).assertEqual(-0.5); - }); - - /** - * @tc.number: TEST_COMPARE_001 - * @tc.name : testCompare001 - * @tc.desc : Compares the current RationalNumber object with a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompare001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let proc = util.RationalNumber.parseRationalNumber(3, 4); - let res = pro.compare(proc); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_COMPARE_002 - * @tc.name : testCompare002 - * @tc.desc : Compares the current RationalNumber object with a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompare002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let proc = util.RationalNumber.parseRationalNumber(0, 0); - let res = pro.compare(proc); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_COMPARE_003 - * @tc.name : testCompare003 - * @tc.desc : Compares the current RationalNumber object with a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompare003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let proc = util.RationalNumber.parseRationalNumber(8, 3); - let res = pro.compare(proc); - expect(res).assertEqual(-1); - }); - - /** - * @tc.number: TEST_COMPARE_004 - * @tc.name : testCompare004 - * @tc.desc : Compares the current RationalNumber object with a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompare004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let proc = util.RationalNumber.parseRationalNumber(2, 1); - let res = pro.compare(proc); - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_COMPARE_005 - * @tc.name : testCompare005 - * @tc.desc : Compares the current RationalNumber object with a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompare005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 0); - let proc = util.RationalNumber.parseRationalNumber(2, 1); - let res = pro.compare(proc); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_EQUALS_001 - * @tc.name : testEquals001 - * @tc.desc : Checks whether a given object is the same as the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEquals001", 0, function () { - let pro = new util.RationalNumber(); - expect(pro != null).assertTrue(); - let proc = new util.RationalNumber(); - let res = pro.equals(proc); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUALS_002 - * @tc.name : testEquals002 - * @tc.desc : Checks whether a given object is the same as the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEquals002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(1, 2); - let proc = util.RationalNumber.parseRationalNumber(4, 2); - let res = pro.equals(proc); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUALS_003 - * @tc.name : testEquals003 - * @tc.desc : Checks whether a given object is the same as the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEquals003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 1); - let proc = util.RationalNumber.parseRationalNumber(0, 2); - let res = pro.equals(proc); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_EQUALS_004 - * @tc.name : testEquals004 - * @tc.desc : Checks whether a given object is the same as the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEquals004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 0); - let proc = util.RationalNumber.parseRationalNumber(0, 2); - let res = pro.equals(proc); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_EQUALS_005 - * @tc.name : testEquals005 - * @tc.desc : Checks whether a given object is the same as the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEquals005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 0); - let proc = util.RationalNumber.parseRationalNumber(2, 0); - let res = pro.equals(proc); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_VALUE_OF_001 - * @tc.name : testRationalNumberValueOf001 - * @tc.desc : Obtains the value of the current RationalNumber object as a number. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberValueOf001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let res = pro.valueOf(); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_VALUE_OF_002 - * @tc.name : testRationalNumberValueOf002 - * @tc.desc : Obtains the value of the current RationalNumber object as a number. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberValueOf002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 10); - let res = pro.valueOf(); - expect(res).assertEqual(0.2); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_VALUE_OF_003 - * @tc.name : testRationalNumberValueOf003 - * @tc.desc : Obtains the value of the current RationalNumber object as a number. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberValueOf003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(1, 2); - let res = pro.valueOf(); - expect(res).assertEqual(0.5); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_VALUE_OF_004 - * @tc.name : testRationalNumberValueOf004 - * @tc.desc : Obtains the value of the current RationalNumber object as a number. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberValueOf004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(4, 2); - let res = pro.valueOf(); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_VALUE_OF_005 - * @tc.name : testRationalNumberValueOf005 - * @tc.desc : Obtains the value of the current RationalNumber object as a number. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberValueOf005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(4, 1); - let res = pro.valueOf(); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_GET_COMMON_FACTOR_001 - * @tc.name : testGetCommonFactor001 - * @tc.desc : Obtains the greatest common divisor of two specified numbers. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCommonFactor001", 0, function () { - let res = util.RationalNumber.getCommonFactor(4, 8); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_GET_COMMON_FACTOR_002 - * @tc.name : testGetCommonFactor002 - * @tc.desc : Obtains the greatest common divisor of two specified numbers. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCommonFactor002", 0, function () { - let res = util.RationalNumber.getCommonFactor(10, 15); - expect(res).assertEqual(5); - }); - - /** - * @tc.number: TEST_GET_COMMON_FACTOR_003 - * @tc.name : testGetCommonFactor003 - * @tc.desc : Obtains the greatest common divisor of two specified numbers. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCommonFactor003", 0, function () { - let res = util.RationalNumber.getCommonFactor(8, 4); - expect(res).assertEqual(4); - }); - - /** - * @tc.number: TEST_GET_COMMON_FACTOR_004 - * @tc.name : testGetCommonFactor004 - * @tc.desc : Obtains the greatest common divisor of two specified numbers. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCommonFactor004", 0, function () { - let res = util.RationalNumber.getCommonFactor(8, 16); - expect(res).assertEqual(8); - }); - - /** - * @tc.number: TEST_GET_COMMON_FACTOR_005 - * @tc.name : testGetCommonFactor005 - * @tc.desc : Obtains the greatest common divisor of two specified numbers. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetCommonFactor005", 0, function () { - let res = util.RationalNumber.getCommonFactor(2, 16); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_001 - * @tc.name : testGetDenominator001 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 1); - let res = pro.getDenominator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_002 - * @tc.name : testGetDenominator002 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 3); - let res = pro.getDenominator(); - expect(res).assertEqual(3); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_003 - * @tc.name : testGetDenominator003 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 0); - let res = pro.getDenominator(); - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_004 - * @tc.name : testGetDenominator004 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 5); - let res = pro.getDenominator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_005 - * @tc.name : testGetDenominator005 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(6, 3); - let res = pro.getDenominator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_DENOMINATOR_006 - * @tc.name : testGetDenominator006 - * @tc.desc : Obtains the denominator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDenominator006", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(6, -3); - let res = pro.getDenominator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_NUMERATOR_001 - * @tc.name : testGetNumerator001 - * @tc.desc : Obtains the numerator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNumerator001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 1); - let res = pro.getNumerator(); - expect(res).assertEqual(-2); - }); - - /** - * @tc.number: TEST_GET_NUMERATOR_002 - * @tc.name : testGetNumerator002 - * @tc.desc : Obtains the numerator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNumerator002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 3); - let res = pro.getNumerator(); - expect(res).assertEqual(0); - }); - - /** - * @tc.number: TEST_GET_NUMERATOR_003 - * @tc.name : testGetNumerator003 - * @tc.desc : Obtains the numerator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNumerator003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 4); - let res = pro.getNumerator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_NUMERATOR_004 - * @tc.name : testGetNumerator004 - * @tc.desc : Obtains the numerator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNumerator004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(3, 6); - let res = pro.getNumerator(); - expect(res).assertEqual(1); - }); - - /** - * @tc.number: TEST_GET_NUMERATOR_005 - * @tc.name : testGetNumerator005 - * @tc.desc : Obtains the numerator of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNumerator005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 5); - let res = pro.getNumerator(); - expect(res).assertEqual(2); - }); - - /** - * @tc.number: TEST_IS_FINITE_001 - * @tc.name : testIsFinite001 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFinite001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 1); - let res = pro.isFinite(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_FINITE_002 - * @tc.name : testIsFinite002 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFinite002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 3); - let res = pro.isFinite(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_FINITE_003 - * @tc.name : testIsFinite003 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFinite003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 0); - let res = pro.isFinite(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_FINITE_004 - * @tc.name : testIsFinite004 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFinite004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(1, 3); - let res = pro.isFinite(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_FINITE_005 - * @tc.name : testIsFinite005 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsFinite005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 5); - let res = pro.isFinite(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NAN_001 - * @tc.name : testIsNaN001 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNaN001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 1); - let res = pro.isNaN(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NAN_002 - * @tc.name : testIsNaN002 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNaN002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 3); - let res = pro.isNaN(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NAN_003 - * @tc.name : testIsNaN003 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNaN003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 0); - let res = pro.isNaN(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_NAN_004 - * @tc.name : testIsNaN004 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNaN004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 0); - let res = pro.isNaN(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_NAN_005 - * @tc.name : testIsNaN005 - * @tc.desc : Checks whether the current RationalNumber object represents a finite value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsNaN005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 1); - let res = pro.isNaN(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ZERO_001 - * @tc.name : testIsZero001 - * @tc.desc : Checks whether the current RationalNumber object represents the value 0. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsZero001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 1); - let res = pro.isZero(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ZERO_002 - * @tc.name : testIsZero002 - * @tc.desc : Checks whether the current RationalNumber object represents the value 0. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsZero002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 3); - let res = pro.isZero(); - expect(res).assertEqual(true); - }); - - /** - * @tc.number: TEST_IS_ZERO_003 - * @tc.name : testIsZero003 - * @tc.desc : Checks whether the current RationalNumber object represents the value 0. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsZero003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 0); - let res = pro.isZero(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ZERO_004 - * @tc.name : testIsZero004 - * @tc.desc : Checks whether the current RationalNumber object represents the value 0. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsZero004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(10, 2); - let res = pro.isZero(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_IS_ZERO_005 - * @tc.name : testIsZero005 - * @tc.desc : Checks whether the current RationalNumber object represents the value 0. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsZero005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(1, 1); - let res = pro.isZero(); - expect(res).assertEqual(false); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_TO_STRING_001 - * @tc.name : testRationalNumberToString001 - * @tc.desc : Obtains a string representation of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberToString001", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-2, 1); - let res = pro.toString(); - expect(res).assertEqual("-2/1"); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_TO_STRING_002 - * @tc.name : testRationalNumberToString002 - * @tc.desc : Obtains a string representation of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberToString002", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(0, 0); - let res = pro.toString(); - expect(res).assertEqual("NaN"); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_TO_STRING_003 - * @tc.name : testRationalNumberToString003 - * @tc.desc : Obtains a string representation of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberToString003", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(3, 0); - let res = pro.toString(); - expect(res).assertEqual("Infinity"); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_TO_STRING_004 - * @tc.name : testRationalNumberToString004 - * @tc.desc : Obtains a string representation of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberToString004", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(-3, 0); - let res = pro.toString(); - expect(res).assertEqual("-Infinity"); - }); - - /** - * @tc.number: TEST_RATIONAL_NUMBER_TO_STRING_005 - * @tc.name : testRationalNumberToString005 - * @tc.desc : Obtains a string representation of the current RationalNumber object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testRationalNumberToString005", 0, function () { - let pro = util.RationalNumber.parseRationalNumber(2, 3); - let res = pro.toString(); - expect(res).assertEqual("2/3"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_UPDATE_GET_CAPACITY_001 - * @tc.name : testLruCacheUpdateGetCapacity001 - * @tc.desc : Updates the buffer capacity to a specified capacity. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheUpdateGetCapacity001", 0, function () { - let that = new util.LRUCache(); - expect(that != null).assertTrue(); - that.updateCapacity(10); - let result = that.getCapacity(); - expect(result).assertEqual(10); - }); - - /** - * @tc.number: TEST_LRU_CACHE_UPDATE_GET_CAPACITY_002 - * @tc.name : testLruCacheUpdateGetCapacity002 - * @tc.desc : Updates the buffer capacity to a specified capacity. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheUpdateGetCapacity002", 0, function () { - let that = new util.LRUCache(); - expect(that != null).assertTrue(); - that.updateCapacity(2147483646); - let result = that.getCapacity(); - expect(result).assertEqual(2147483646); - }); - - /** - * @tc.number: TEST_LRU_CACHE_UPDATE_GET_CAPACITY_003 - * @tc.name : testLruCacheUpdateGetCapacity003 - * @tc.desc : Updates the buffer capacity to a specified capacity. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheUpdateGetCapacity003", 0, function () { - let that = new util.LRUCache(100); - expect(that != null).assertTrue(); - that.updateCapacity(20); - let result = that.getCapacity(); - expect(result).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_UPDATE_GET_CAPACITY_004 - * @tc.name : testLruCacheUpdateGetCapacity004 - * @tc.desc : Updates the buffer capacity to a specified capacity. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheUpdateGetCapacity004", 0, function () { - let that = new util.LRUCache(50); - expect(that != null).assertTrue(); - that.updateCapacity(2); - let result = that.getCapacity(); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_UPDATE_GET_CAPACITY_005 - * @tc.name : testLruCacheUpdateGetCapacity005 - * @tc.desc : Updates the buffer capacity to a specified capacity. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheUpdateGetCapacity005", 0, function () { - let that = new util.LRUCache(200); - expect(that != null).assertTrue(); - that.updateCapacity(100); - let result = that.getCapacity(); - expect(result).assertEqual(100); - }); - - /** - * @tc.number: TEST_LRU_CACHE_TO_STRING_001 - * @tc.name : testLruCacheToString001 - * @tc.desc : Returns a string representation of the object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheToString001", 0, function () { - let that = new util.LRUCache(); - that.put("1111", "bcjdshc"); - that.put(1, 2); - let result = that.toString(); - expect(result).assertEqual("LRUCache[ maxSize = 64, hits = 0, misses = 0, hitRate = 0% ]"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_TO_STRING_002 - * @tc.name : testLruCacheToString002 - * @tc.desc : Returns a string representation of the object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheToString002", 0, function () { - let that = new util.LRUCache(); - that.put("1111", "bcjdshc"); - that.put(1, 2); - that.get(1); - that.get("1111"); - let result = that.toString(); - expect(result).assertEqual("LRUCache[ maxSize = 64, hits = 2, misses = 0, hitRate = 100% ]"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_TO_STRING_003 - * @tc.name : testLruCacheToString003 - * @tc.desc : Returns a string representation of the object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheToString003", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - let result = that.toString(); - expect(result).assertEqual("LRUCache[ maxSize = 100, hits = 1, misses = 0, hitRate = 100% ]"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_TO_STRING_004 - * @tc.name : testLruCacheToString004 - * @tc.desc : Returns a string representation of the object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheToString004", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.get(2); - let result = that.toString(); - expect(result).assertEqual("LRUCache[ maxSize = 100, hits = 1, misses = 1, hitRate = 50% ]"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_TO_STRING_005 - * @tc.name : testLruCacheToString005 - * @tc.desc : Returns a string representation of the object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheToString005", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.get(2); - that.get(1); - that.contains(5); - let result = that.toString(); - expect(result).assertEqual("LRUCache[ maxSize = 100, hits = 3, misses = 1, hitRate = 75% ]"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_LENGTH_001 - * @tc.name : testLruCacheLength001 - * @tc.desc : Obtains the total number of values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheLength001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result = that.length; - expect(result).assertEqual(1); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CAPACITY_001 - * @tc.name : testLruCacheGetCapacity001 - * @tc.desc : Obtains the capacity of the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCapacity001", 0, function () { - let that = new util.LRUCache(); - let result = that.getCapacity(); - expect(result).assertEqual(64); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CAPACITY_002 - * @tc.name : testLruCacheGetCapacity002 - * @tc.desc : Obtains the capacity of the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCapacity002", 0, function () { - let that = new util.LRUCache(2); - let result = that.getCapacity(); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CAPACITY_003 - * @tc.name : testLruCacheGetCapacity003 - * @tc.desc : Obtains the capacity of the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCapacity003", 0, function () { - let that = new util.LRUCache(100); - let result = that.getCapacity(); - expect(result).assertEqual(100); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CAPACITY_004 - * @tc.name : testLruCacheGetCapacity004 - * @tc.desc : Obtains the capacity of the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCapacity004", 0, function () { - let that = new util.LRUCache(); - that.updateCapacity(50); - let result = that.getCapacity(); - expect(result).assertEqual(50); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CAPACITY_005 - * @tc.name : testLruCacheGetCapacity005 - * @tc.desc : Obtains the capacity of the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCapacity005", 0, function () { - let that = new util.LRUCache(100); - that.updateCapacity(10); - let result = that.getCapacity(); - expect(result).assertEqual(10); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CLEAR_001 - * @tc.name : testLruCacheClear001 - * @tc.desc : Clears key-value pairs from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheClear001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result1 = that.length; - that.clear(); - let result2 = that.length; - expect(result1).assertEqual(1); - expect(result2).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CLEAR_002 - * @tc.name : testLruCacheClear002 - * @tc.desc : Clears key-value pairs from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheClear002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put(5, 33); - that.put(25, 35); - let result1 = that.length; - that.clear(); - let result2 = that.length; - expect(result1).assertEqual(4); - expect(result2).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CLEAR_003 - * @tc.name : testLruCacheClear003 - * @tc.desc : Clears key-value pairs from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheClear003", 0, function () { - let that = new util.LRUCache(); - that.put("abc", 2); - that.put(2, "abc"); - that.put("ancd", "abcd"); - that.put(10, 35); - let result1 = that.length; - that.clear(); - let result2 = that.length; - expect(result1).assertEqual(4); - expect(result2).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CLEAR_004 - * @tc.name : testLruCacheClear004 - * @tc.desc : Clears key-value pairs from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheClear004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put(5, 33); - that.updateCapacity(3); - let result1 = that.length; - that.clear(); - let result2 = that.length; - expect(result1).assertEqual(3); - expect(result2).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CLEAR_005 - * @tc.name : testLruCacheClear005 - * @tc.desc : Clears key-value pairs from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheClear005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put(5, 33); - that.put("abcd", "string"); - that.updateCapacity(2); - let result1 = that.length; - that.clear(); - let result2 = that.length; - expect(result1).assertEqual(2); - expect(result2).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CREATE_COUNT_001 - * @tc.name : testLruCacheGetCreateCount001 - * @tc.desc : Obtains the number of times createDefault(Object) returned a value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCreateCount001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(3); - that.get(5); - that.get(10); - let result = that.getCreateCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CREATE_COUNT_002 - * @tc.name : testLruCacheGetCreateCount002 - * @tc.desc : Obtains the number of times createDefault(Object) returned a value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCreateCount002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(6); - that.get(8); - that.get(20); - let result = that.getCreateCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CREATE_COUNT_003 - * @tc.name : testLruCacheGetCreateCount003 - * @tc.desc : Obtains the number of times createDefault(Object) returned a value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCreateCount003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.get("abc"); - that.get("cndk"); - let result = that.getCreateCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CREATE_COUNT_004 - * @tc.name : testLruCacheGetCreateCount004 - * @tc.desc : Obtains the number of times createDefault(Object) returned a value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCreateCount004", 0, function () { - let that = new util.LRUCache(); - that.put(5, 2); - that.put(10, 10); - that.put("abcd", "abcd"); - that.get(5); - that.get(20); - that.get(12); - let result = that.getCreateCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_CREATE_COUNT_005 - * @tc.name : testLruCacheGetCreateCount005 - * @tc.desc : Obtains the number of times createDefault(Object) returned a value. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetCreateCount005", 0, function () { - let that = new util.LRUCache(); - that.put("xsjk", "bcjds"); - that.put("ajc", 10); - that.put("abcd", 15); - that.get(2); - that.get(10); - that.get(30); - let result = that.getCreateCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_001 - * @tc.name : testLruCacheGetMissCount001 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(3); - that.get(5); - that.get(10); - let result = that.getMissCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_002 - * @tc.name : testLruCacheGetMissCount002 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount002", 0, function () { - let that = new util.LRUCache(); - that.put(5, 2); - that.put(1, 10); - that.put("abcd", "bcjsc"); - that.get(2); - that.get(10); - that.get(15); - let result = that.getMissCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_003 - * @tc.name : testLruCacheGetMissCount003 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount003", 0, function () { - let that = new util.LRUCache(); - that.put(10, 10); - that.put(3, 20); - that.put(12, 16); - that.get(1); - that.get(2); - that.get(6); - let result = that.getMissCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_004 - * @tc.name : testLruCacheGetMissCount004 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount004", 0, function () { - let that = new util.LRUCache(); - that.put("acb", "asdc"); - that.put("vfb", 1); - that.put("abcd", "abcd"); - that.get(3); - that.get(5); - that.get(10); - let result = that.getMissCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_005 - * @tc.name : testLruCacheGetMissCount005 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(3); - that.get(5); - that.get(10); - that.contains(2); - that.contains(6); - let result = that.getMissCount(); - expect(result).assertEqual(4); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MISS_COUNT_006 - * @tc.name : testLruCacheGetMissCount006 - * @tc.desc : Obtains the number of times that the queried values are not matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMissCount006", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(1); - that.get(2); - that.get("abcd"); - let result = that.getMissCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_REMOVAL_COUNT_001 - * @tc.name : testLruCacheGetRemovalCount001 - * @tc.desc : Obtains the number of times that values are evicted from the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetRemovalCount001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.put(3, 20); - that.put(5, 30); - let result = that.getRemovalCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_REMOVAL_COUNT_002 - * @tc.name : testLruCacheGetRemovalCount002 - * @tc.desc : Obtains the number of times that values are evicted from the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetRemovalCount002", 0, function () { - let that = new util.LRUCache(); - that.put(10, 2); - that.put(3, 2); - that.put(15, 15); - that.put(1, 20); - let result = that.getRemovalCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_REMOVAL_COUNT_003 - * @tc.name : testLruCacheGetRemovalCount003 - * @tc.desc : Obtains the number of times that values are evicted from the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetRemovalCount003", 0, function () { - let that = new util.LRUCache(); - that.put("abc", 2); - that.put("abcd", "abcd"); - that.put(3, 2); - let result = that.getRemovalCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_REMOVAL_COUNT_004 - * @tc.name : testLruCacheGetRemovalCount004 - * @tc.desc : Obtains the number of times that values are evicted from the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetRemovalCount004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.updateCapacity(2); - that.put(3, 20); - that.put(5, 30); - let result = that.getRemovalCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_REMOVAL_COUNT_005 - * @tc.name : testLruCacheGetRemovalCount005 - * @tc.desc : Obtains the number of times that values are evicted from the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetRemovalCount005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.updateCapacity(3); - that.put("string", 20); - that.put("abc", 30); - that.put(10, 20); - let result = that.getRemovalCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_001 - * @tc.name : testLruCacheGetMatchCount001 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(1); - that.get(2); - that.get("abcd"); - let result = that.getMatchCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_002 - * @tc.name : testLruCacheGetMatchCount002 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount002", 0, function () { - let that = new util.LRUCache(); - that.put(10, 2); - that.put(2, 1); - that.put("abcd", 15); - that.get(10); - that.get(2); - that.get("abcd"); - that.get("string"); - let result = that.getMatchCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_003 - * @tc.name : testLruCacheGetMatchCount003 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount003", 0, function () { - let that = new util.LRUCache(); - that.put(0, 1); - that.put(30, 10); - that.put("abcd", 15); - that.get(0); - that.get(30); - that.get("abcd"); - let result = that.getMatchCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_004 - * @tc.name : testLruCacheGetMatchCount004 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(1); - that.get(2); - that.get("abcd"); - that.contains(2); - that.contains("abcd"); - that.contains(20); - let result = that.getMatchCount(); - expect(result).assertEqual(5); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_005 - * @tc.name : testLruCacheGetMatchCount005 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.put("string", "string"); - that.get(1); - that.get(2); - that.get("abcd"); - that.get("string"); - that.contains(2); - that.contains("abcd"); - that.contains("string"); - that.contains(10); - let result = that.getMatchCount(); - expect(result).assertEqual(7); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_MATCH_COUNT_006 - * @tc.name : testLruCacheGetMatchCount006 - * @tc.desc : Obtains the number of times that the queried values are successfully matched. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetMatchCount006", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - that.get(5); - let result = that.getMatchCount(); - expect(result).assertEqual(0); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_PUT_COUNT_001 - * @tc.name : testLruCacheGetPutCount001 - * @tc.desc : Obtains the number of times that values are added to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetPutCount001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result = that.getPutCount(); - expect(result).assertEqual(1); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_PUT_COUNT_002 - * @tc.name : testLruCacheGetPutCount002 - * @tc.desc : Obtains the number of times that values are added to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetPutCount002", 0, function () { - let that = new util.LRUCache(); - that.put(5, 3); - that.put(2, 10); - let result = that.getPutCount(); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_PUT_COUNT_003 - * @tc.name : testLruCacheGetPutCount003 - * @tc.desc : Obtains the number of times that values are added to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetPutCount003", 0, function () { - let that = new util.LRUCache(); - that.put("string", 2); - that.put("abcd", 1); - that.put("ab", "a"); - let result = that.getPutCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_PUT_COUNT_004 - * @tc.name : testLruCacheGetPutCount004 - * @tc.desc : Obtains the number of times that values are added to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetPutCount004", 0, function () { - let that = new util.LRUCache(); - that.put("string", "string"); - that.put("ac", "abc"); - that.put("abcd", 15); - let result = that.getPutCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_PUT_COUNT_005 - * @tc.name : testLruCacheGetPutCount005 - * @tc.desc : Obtains the number of times that values are added to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGetPutCount005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.updateCapacity(2); - that.put("abcd", "abc"); - let result = that.getPutCount(); - expect(result).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_IS_EMPTY_001 - * @tc.name : testLruCacheIsEmpty001 - * @tc.desc : Checks whether the current buffer is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheIsEmpty001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result = that.isEmpty(); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_IS_EMPTY_002 - * @tc.name : testLruCacheIsEmpty002 - * @tc.desc : Checks whether the current buffer is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheIsEmpty002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - let result = that.isEmpty(); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_IS_EMPTY_003 - * @tc.name : testLruCacheIsEmpty003 - * @tc.desc : Checks whether the current buffer is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheIsEmpty003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put(5, 33); - let result = that.isEmpty(); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_IS_EMPTY_004 - * @tc.name : testLruCacheIsEmpty004 - * @tc.desc : Checks whether the current buffer is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheIsEmpty004", 0, function () { - let that = new util.LRUCache(); - that.put("abc", 2); - that.put("string", 10); - that.put("ab", "abc"); - let result = that.isEmpty(); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_IS_EMPTY_005 - * @tc.name : testLruCacheIsEmpty005 - * @tc.desc : Checks whether the current buffer is empty. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheIsEmpty005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(2, 10); - that.put(5, 33); - that.clear(); - let result = that.isEmpty(); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_001 - * @tc.name : testLruCacheGet001 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet001", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - let result = that.get(1); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_002 - * @tc.name : testLruCacheGet002 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet002", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - let result = that.get(5); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_003 - * @tc.name : testLruCacheGet003 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet003", 0, function () { - let that = new util.LRUCache(100); - that.put(1, 2); - that.put(2, 10); - that.put("abcd", 15); - let result1 = that.get(20); - let result2 = that.get("abcd"); - let result3 = that.get(2); - expect(result1).assertEqual(undefined); - expect(result2).assertEqual(15); - expect(result3).assertEqual(10); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_004 - * @tc.name : testLruCacheGet004 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet004", 0, function () { - let that = new util.LRUCache(); - that.put("1111", "bcjdshc"); - that.put(20, "cdjcaxb"); - that.put("abcd", 15); - let result1 = that.get("1111"); - let result2 = that.get(20); - let result3 = that.get("abcd"); - let result4 = that.get(25); - expect(result1).assertEqual("bcjdshc"); - expect(result2).assertEqual("cdjcaxb"); - expect(result3).assertEqual(15); - expect(result4).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_005 - * @tc.name : testLruCacheGet005 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet005", 0, function () { - let that = new util.LRUCache(); - that.put("1111", "bcjdshc"); - that.put(20, "cdjcaxb"); - that.updateCapacity(2); - that.put("abcd", 15); - let result1 = that.get("1111"); - let result2 = that.get(20); - let result3 = that.get("abcd"); - let result4 = that.get(25); - expect(result1).assertEqual(undefined); - expect(result2).assertEqual("cdjcaxb"); - expect(result3).assertEqual(15); - expect(result4).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_GET_005 - * @tc.name : testLruCacheGet005 - * @tc.desc : Obtains the value associated with a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheGet006", 0, function () { - let that = new util.LRUCache(); - let un = undefined; - that.put(20, "cdjcaxb"); - try { - let result1 = that.get(un); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of undefined must be Object"); - expect(e.code).assertEqual(401); - expect(e.message).assertEqual("Parameter error.The type of undefined must be Object"); - } - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_001 - * @tc.name : testLruCachePut001 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut001", 0, function () { - let that = new util.LRUCache(); - let temp = that.put("1111", "bcjdshc"); - expect(temp).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_002 - * @tc.name : testLruCachePut002 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut002", 0, function () { - let that = new util.LRUCache(); - let temp1 = that.put("1111", "bcjdshc"); - let temp2 = that.put("1111", 13); - expect(temp2).assertEqual("bcjdshc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_003 - * @tc.name : testLruCachePut003 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut003", 0, function () { - let that = new util.LRUCache(); - let temp = that.put("1111", "bcjdshc"); - let temp1 = that.put(1, 12); - let temp2 = that.put(2, 5); - let temp3 = that.put(2, "adasfdad"); - let temp4 = that.put("abc", 10); - expect(temp1).assertEqual(undefined); - expect(temp2).assertEqual(undefined); - expect(temp3).assertEqual(5); - expect(temp4).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_004 - * @tc.name : testLruCachePut004 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut004", 0, function () { - let that = new util.LRUCache(); - let temp = that.put("1111", "bcjdshc"); - let temp1 = that.put(1, 12); - let temp2 = that.put(2, 5); - that.updateCapacity(2); - let temp3 = that.put(2, "adasfdad"); - let temp4 = that.put("1111", 10); - expect(temp).assertEqual(undefined); - expect(temp1).assertEqual(undefined); - expect(temp2).assertEqual(undefined); - expect(temp3).assertEqual(5); - expect(temp4).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_005 - * @tc.name : testLruCachePut005 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut005", 0, function () { - let that = new util.LRUCache(); - let temp = that.put("1111", "bcjdshc"); - let temp1 = that.put(1, 12); - let temp2 = that.put(2, 5); - let temp3 = that.put(1, 10); - let temp4 = that.put(2, 22); - let temp5 = that.put(2, 30); - expect(temp).assertEqual(undefined); - expect(temp1).assertEqual(undefined); - expect(temp2).assertEqual(undefined); - expect(temp3).assertEqual(12); - expect(temp4).assertEqual(5); - expect(temp5).assertEqual(22); - }); - - /** - * @tc.number: TEST_LRU_CACHE_PUT_006 - * @tc.name : testLruCachePut006 - * @tc.desc : Adds a key-value pair to the buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCachePut006", 0, function () { - let that = new util.LRUCache(); - let un = undefined; - try { - that.put(un, "bcjdshc"); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of undefined must be Object"); - expect(e.code).assertEqual(401); - expect(e.message).assertEqual("Parameter error.The type of undefined must be Object"); - } - }); - - /** - * @tc.number: TEST_LRU_CACHE_VALUES_001 - * @tc.name : testLruCacheValues001 - * @tc.desc : Obtains a list of all values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheValues001", 0, function () { - let that = new util.LRUCache(); - that.put("string", "abc"); - let result = that.values(); - expect(result[0]).assertEqual("abc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_VALUES_002 - * @tc.name : testLruCacheValues002 - * @tc.desc : Obtains a list of all values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheValues002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - let result = that.values(); - expect(result[0]).assertEqual(2); - expect(result[1]).assertEqual(10); - expect(result[2]).assertEqual(15); - expect(result[3]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_VALUES_003 - * @tc.name : testLruCacheValues003 - * @tc.desc : Obtains a list of all values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheValues003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - let result = that.values(); - expect(result[0]).assertEqual(2); - expect(result[1]).assertEqual(15); - expect(result[2]).assertEqual(20); - expect(result[3]).assertEqual(10); - }); - - /** - * @tc.number: TEST_LRU_CACHE_VALUES_004 - * @tc.name : testLruCacheValues004 - * @tc.desc : Obtains a list of all values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheValues004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.contains(1); - let result = that.values(); - expect(result[0]).assertEqual(15); - expect(result[1]).assertEqual(20); - expect(result[2]).assertEqual(10); - expect(result[3]).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_VALUES_005 - * @tc.name : testLruCacheValues005 - * @tc.desc : Obtains a list of all values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheValues005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.remove(5); - that.contains(3); - that.get(1); - that.contains("abc"); - let result = that.values(); - expect(result[0]).assertEqual(10); - expect(result[1]).assertEqual(2); - expect(result[2]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_KEYS_001 - * @tc.name : testLruCacheKeys001 - * @tc.desc : Obtains a list of keys for the values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheKeys001", 0, function () { - let that = new util.LRUCache(); - that.put("string", "abc"); - let result = that.keys(); - expect(result[0]).assertEqual("string"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_KEYS_002 - * @tc.name : testLruCacheKeys002 - * @tc.desc : Obtains a list of keys for the values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheKeys002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - let result = that.keys(); - expect(result[0]).assertEqual(1); - expect(result[1]).assertEqual(3); - expect(result[2]).assertEqual(5); - expect(result[3]).assertEqual("abc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_KEYS_003 - * @tc.name : testLruCacheKeys003 - * @tc.desc : Obtains a list of keys for the values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheKeys003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - let result = that.keys(); - expect(result[0]).assertEqual(1); - expect(result[1]).assertEqual(5); - expect(result[2]).assertEqual("abc"); - expect(result[3]).assertEqual(3); - }); - - /** - * @tc.number: TEST_LRU_CACHE_KEYS_004 - * @tc.name : testLruCacheKeys004 - * @tc.desc : Obtains a list of keys for the values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheKeys004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.contains(1); - let result = that.keys(); - expect(result[0]).assertEqual(5); - expect(result[1]).assertEqual("abc"); - expect(result[2]).assertEqual(3); - expect(result[3]).assertEqual(1); - }); - - /** - * @tc.number: TEST_LRU_CACHE_KEYS_005 - * @tc.name : testLruCacheKeys005 - * @tc.desc : Obtains a list of keys for the values in the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheKeys005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.remove(5); - that.contains(3); - that.get(1); - that.contains("abc"); - let result = that.keys(); - expect(result[0]).assertEqual(3); - expect(result[1]).assertEqual(1); - expect(result[2]).assertEqual("abc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_001 - * @tc.name : testLruCacheRemove001 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result = that.remove(1); - expect(result).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_002 - * @tc.name : testLruCacheRemove002 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put("abcd", 20); - let result1 = that.remove(1); - let result2 = that.remove("abcd"); - expect(result1).assertEqual(2); - expect(result2).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_003 - * @tc.name : testLruCacheRemove003 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result1 = that.remove(1); - let result2 = that.remove(5); - expect(result1).assertEqual(2); - expect(result2).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_004 - * @tc.name : testLruCacheRemove004 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove004", 0, function () { - let that = new util.LRUCache(); - that.put(0, "abc"); - that.put("abcd", 20); - let result1 = that.remove(1); - let result2 = that.remove("abcd"); - expect(result1).assertEqual(undefined); - expect(result2).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_005 - * @tc.name : testLruCacheRemove005 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - let result1 = that.remove(1); - let result2 = that.remove(3); - let result3 = that.get(3); - expect(result1).assertEqual(2); - expect(result2).assertEqual(10); - expect(result3).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_REMOVE_006 - * @tc.name : testLruCacheRemove006 - * @tc.desc : Deletes a specified key and its associated value from the current buffer. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheRemove006", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let un = undefined; - try { - that.remove(un); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of undefined must be Object"); - expect(e.code).assertEqual(401); - expect(e.message).assertEqual("Parameter error.The type of undefined must be Object"); - } - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_001 - * @tc.name : testLruCacheAfterRemoval001 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval001", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor() { - super(); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arr = [key, value, newValue]; - } - } - } - let lru = new ChildLRUCache(); - lru.afterRemoval(false, 10, 30, null); - expect(arr[0]).assertEqual(10); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_002 - * @tc.name : testLruCacheAfterRemoval002 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval002", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor() { - super(); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arr = [key, value, newValue]; - } - } - } - let lru = new ChildLRUCache(); - lru.afterRemoval(false, "string", 10, null); - expect(arr[0]).assertEqual("string"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_003 - * @tc.name : testLruCacheAfterRemoval003 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval003", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor() { - super(); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arr = [key, value, newValue]; - } - } - } - let lru = new ChildLRUCache(); - lru.afterRemoval(false, 10, 30, 12); - expect(arr[2]).assertEqual(12); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_004 - * @tc.name : testLruCacheAfterRemoval004 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval004", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor() { - super(); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arr = [key, value, newValue]; - } - } - } - let lru = new ChildLRUCache(); - lru.afterRemoval(false, "abc", 30, "string"); - expect(arr[1]).assertEqual(30); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_005 - * @tc.name : testLruCacheAfterRemoval005 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval005", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor() { - super(); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === true) { - arr = [key, value, newValue]; - } - } - } - let lru = new ChildLRUCache(); - lru.afterRemoval(true, "abc", "ab", "string"); - expect(arr[2]).assertEqual("string"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_006 - * @tc.name : testLruCacheAfterRemoval006 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval006", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor(capacity) { - super(capacity); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === true) { - arr = [key, value]; - } - } - } - let that = new ChildLRUCache(2); - that.put(1, 2); - that.put(3, 10); - that.put("abc", 20); - expect(arr[1]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_007 - * @tc.name : testLruCacheAfterRemoval007 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval007", 0, function () { - let arr = []; - class ChildLRUCache extends util.LRUCache { - constructor(capacity) { - super(capacity); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arr = [key, value, newValue]; - } - } - } - let that = new ChildLRUCache(3); - that.put(1, 2); - that.put(3, 10); - that.put(1, 8); - expect(arr[2]).assertEqual(8); - }); - - /** - * @tc.number: TEST_LRU_CACHE_AFTER_REMOVAL_008 - * @tc.name : testLruCacheAfterRemoval008 - * @tc.desc : Executes subsequent operations after a value is deleted. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheAfterRemoval008", 0, function () { - let arrk = []; - let arrv = []; - class ChildLRUCache extends util.LRUCache { - constructor(capacity) { - super(capacity); - } - afterRemoval(isEvict, key, value, newValue) { - if (isEvict === false) { - arrk = Array.from(key); - arrv = Array.from(value); - } - } - } - let that = new ChildLRUCache(3); - that.put(1, 2); - that.put(3, 10); - that.put(2, 8); - that.clear(); - expect(arrk[0]).assertEqual(1); - expect(arrk[1]).assertEqual(3); - expect(arrk[2]).assertEqual(2); - expect(arrv[0]).assertEqual(2); - expect(arrv[1]).assertEqual(10); - expect(arrv[2]).assertEqual(8); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_001 - * @tc.name : testLruCacheContains001 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains001", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - let result = that.contains(1); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_002 - * @tc.name : testLruCacheContains002 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains002", 0, function () { - let that = new util.LRUCache(); - that.put(0, 5); - let result = that.contains(0); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_003 - * @tc.name : testLruCacheContains003 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains003", 0, function () { - let that = new util.LRUCache(); - that.put("abc", "abc"); - let result = that.contains(1); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_004 - * @tc.name : testLruCacheContains004 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put("abcd", 20); - let result1 = that.contains(1); - let result2 = that.contains(20); - expect(result1).assertEqual(true); - expect(result2).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_005 - * @tc.name : testLruCacheContains005 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put("string", "string"); - let result1 = that.contains(1); - let result2 = that.contains("string"); - let result3 = that.contains(0); - expect(result1).assertEqual(true); - expect(result2).assertEqual(true); - expect(result3).assertEqual(false); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CONTAINS_006 - * @tc.name : testLruCacheContains006 - * @tc.desc : Checks whether the current buffer contains a specified key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheContains006", 0, function () { - let that = new util.LRUCache(); - that.put("abc", "abc"); - let un = undefined; - try { - that.contains(un); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of undefined must be Object"); - expect(e.code).assertEqual(401); - expect(e.message).assertEqual("Parameter error.The type of undefined must be Object"); - } - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_001 - * @tc.name : testLruCacheCreateDefault001 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault001", 0, function () { - let that = new util.LRUCache(); - let result = that.createDefault(1); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_002 - * @tc.name : testLruCacheCreateDefault002 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault002", 0, function () { - let that = new util.LRUCache(); - let result = that.createDefault(0); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_003 - * @tc.name : testLruCacheCreateDefault003 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault003", 0, function () { - let that = new util.LRUCache(); - let result = that.createDefault("string"); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_004 - * @tc.name : testLruCacheCreateDefault004 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault004", 0, function () { - let that = new util.LRUCache(); - let result = that.createDefault(10); - expect(result).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_005 - * @tc.name : testLruCacheCreateDefault005 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault005", 0, function () { - let that = new util.LRUCache(); - let result1 = that.createDefault("abc"); - let result2 = that.createDefault("ab"); - expect(result1).assertEqual(undefined); - expect(result2).assertEqual(undefined); - }); - - /** - * @tc.number: TEST_LRU_CACHE_CREATE_DEFAULT_006 - * @tc.name : testLruCacheCreateDefault006 - * @tc.desc : Executes subsequent operations if miss to compute a value for the specific key. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheCreateDefault006", 0, function () { - let that = new util.LRUCache(); - let un = undefined; - try { - that.createDefault(un); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of undefined must be Object"); - expect(e.code).assertEqual(401); - expect(e.message).assertEqual("Parameter error.The type of undefined must be Object"); - } - }); - - /** - * @tc.number: TEST_LRU_CACHE_ENTRIES_001 - * @tc.name : testLruCacheEntries001 - * @tc.desc : Returns an array of key-value pairs of enumeratable properties of a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheEntries001", 0, function () { - let that = new util.LRUCache(); - that.put("string", "abc"); - let i = 0; - let arr = {}; - for (let entry of that.entries()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual("abc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_ENTRIES_002 - * @tc.name : testLruCacheEntries002 - * @tc.desc : Returns an array of key-value pairs of enumeratable properties of a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheEntries002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - let i = 0; - let arr = {}; - for (let entry of that.entries()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_ENTRIES_003 - * @tc.name : testLruCacheEntries003 - * @tc.desc : Returns an array of key-value pairs of enumeratable properties of a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheEntries003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - let i = 0; - let arr = {}; - for (let entry of that.entries()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[0]).assertEqual(1); - }); - - /** - * @tc.number: TEST_LRU_CACHE_ENTRIES_004 - * @tc.name : testLruCacheEntries004 - * @tc.desc : Returns an array of key-value pairs of enumeratable properties of a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheEntries004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.contains(1); - let i = 0; - let arr = {}; - for (let entry of that.entries()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(15); - expect(arr[3]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_ENTRIES_005 - * @tc.name : testLruCacheEntries005 - * @tc.desc : Returns an array of key-value pairs of enumeratable properties of a given object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheEntries005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.remove(5); - that.contains(3); - that.get(1); - that.contains("abc"); - let i = 0; - let arr = {}; - for (let entry of that.entries()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(10); - expect(arr[3]).assertEqual(2); - expect(arr[5]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_SYMBOL_ITERATOR_001 - * @tc.name : testLruCacheSymbolIterator001 - * @tc.desc : Returns a two - dimensional array in the form of key - value pairs. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheSymbolIterator001", 0, function () { - let that = new util.LRUCache(); - that.put("string", "abc"); - that.put("abc", 20); - let i = 0; - let arr = {}; - for (let entry of that[Symbol.iterator]()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual("abc"); - }); - - /** - * @tc.number: TEST_LRU_CACHE_SYMBOL_ITERATOR_002 - * @tc.name : testLruCacheSymbolIterator002 - * @tc.desc : Returns a two - dimensional array in the form of key - value pairs. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheSymbolIterator002", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - let i = 0; - let arr = {}; - for (let entry of that[Symbol.iterator]()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(2); - }); - - /** - * @tc.number: TEST_LRU_CACHE_SYMBOL_ITERATOR_003 - * @tc.name : testLruCacheSymbolIterator003 - * @tc.desc : Returns a two - dimensional array in the form of key - value pairs. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheSymbolIterator003", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - let i = 0; - let arr = {}; - for (let entry of that[Symbol.iterator]()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[0]).assertEqual(1); - }); - - /** - * @tc.number: TEST_LRU_CACHE_SYMBOL_ITERATOR_004 - * @tc.name : testLruCacheSymbolIterator004 - * @tc.desc : Returns a two - dimensional array in the form of key - value pairs. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheSymbolIterator004", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.contains(1); - let i = 0; - let arr = {}; - for (let entry of that[Symbol.iterator]()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(15); - expect(arr[3]).assertEqual(20); - }); - - /** - * @tc.number: TEST_LRU_CACHE_SYMBOL_ITERATOR_005 - * @tc.name : testLruCacheSymbolIterator005 - * @tc.desc : Returns a two - dimensional array in the form of key - value pairs. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testLruCacheSymbolIterator005", 0, function () { - let that = new util.LRUCache(); - that.put(1, 2); - that.put(3, 10); - that.put(5, 15); - that.put("abc", 20); - that.get(3); - that.remove(5); - that.contains(3); - that.get(1); - that.contains("abc"); - let i = 0; - let arr = {}; - for (let entry of that[Symbol.iterator]()) { - arr[i] = entry[0]; - i++; - arr[i] = entry[1]; - i++; - } - expect(arr[1]).assertEqual(10); - expect(arr[3]).assertEqual(2); - expect(arr[5]).assertEqual(20); - }); - - /** - * @tc.number: TEST_COMPARE_TO_001 - * @tc.name : testCompareTo001 - * @tc.desc : Compare the size of two values and return a Boolean value - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testCompareTo001", 0, function () { - let result1 = tempLower.compareTo(tempUpper); - let result2 = tempUpper.compareTo(tempLower); - let result3 = tempMiDF.compareTo(tempLess); - let result4 = tempMore.compareTo(tempMidS); - let result5 = tempLess.compareTo(tempMidS); - expect(result1).assertEqual(false); - expect(result2).assertEqual(true); - expect(result3).assertEqual(true); - expect(result4).assertEqual(true); - expect(result5).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_THROW_ERROR_001 - * @tc.name : testConstructorThrowError001 - * @tc.desc : A constructor used to create a Scope instance with the lower and upper bounds specified. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructorThrowError001", 0, function () { - try { - let range = new util.ScopeHelper(1, 2); - expect(0).assertEqual(1); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 1 must be object"); - } - }); - - /** - * @tc.number: TEST_TO_STRING_001 - * @tc.name : testToString001 - * @tc.desc : Obtains a string representation of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString001", 0, function () { - let result = rangeHp.toString(); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_TO_STRING_002 - * @tc.name : testToString002 - * @tc.desc : Obtains a string representation of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString002", 0, function () { - let result = rangeHpFir.toString(); - expect(result.toString()).assertEqual("[35, 39]"); - }); - - /** - * @tc.number: TEST_TO_STRING_003 - * @tc.name : testToString003 - * @tc.desc : Obtains a string representation of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString003", 0, function () { - let result = rangeHpSec.toString(); - expect(result.toString()).assertEqual("[20, 45]"); - }); - - /** - * @tc.number: TEST_TO_STRING_004 - * @tc.name : testToString004 - * @tc.desc : Obtains a string representation of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString004", 0, function () { - let result = rangeHpThi.toString(); - expect(result.toString()).assertEqual("[20, 35]"); - }); - - /** - * @tc.number: TEST_TO_STRING_005 - * @tc.name : testToString005 - * @tc.desc : Obtains a string representation of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testToString005", 0, function () { - let result = rangeHpFif.toString(); - expect(result.toString()).assertEqual("[35, 45]"); - }); - - /** - * @tc.number: TEST_INTERSECT_001 - * @tc.name : testIntersect001 - * @tc.desc : Returns the intersection of a given range and the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect001", 0, function () { - let result = rangeHp.intersect(rangeHpFir); - expect(result.toString()).assertEqual("[35, 39]"); - }); - - /** - * @tc.number: TEST_INTERSECT_002 - * @tc.name : testIntersect002 - * @tc.desc : Returns the intersection of a given range and the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect002", 0, function () { - let result = rangeHp.intersect(rangeHpSec); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_003 - * @tc.name : testIntersect003 - * @tc.desc : Returns the intersection of a given range and the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect003", 0, function () { - let result = rangeHp.intersect(rangeHpThi); - expect(result.toString()).assertEqual("[30, 35]"); - }); - - /** - * @tc.number: TEST_INTERSECT_004 - * @tc.name : testIntersect004 - * @tc.desc : Returns the intersection of a given range and the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect004", 0, function () { - let result = rangeHp.intersect(rangeHpFif); - expect(result.toString()).assertEqual("[35, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_005 - * @tc.name : testIntersect005 - * @tc.desc : Returns the intersection of a given range and the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect005", 0, function () { - let result = rangeHp.intersect(rangeHp); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_006 - * @tc.name : testIntersect006 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect006", 0, function () { - let result = rangeHp.intersect(tempMiDF, tempMidS); - expect(result.toString()).assertEqual("[35, 39]"); - }); - - /** - * @tc.number: TEST_INTERSECT_007 - * @tc.name : testIntersect007 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect007", 0, function () { - let result = rangeHp.intersect(tempLess, tempMore); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_008 - * @tc.name : testIntersect008 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect008", 0, function () { - let result = rangeHp.intersect(tempLess, tempMiDF); - expect(result.toString()).assertEqual("[30, 35]"); - }); - - /** - * @tc.number: TEST_INTERSECT_009 - * @tc.name : testIntersect009 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect009", 0, function () { - let result = rangeHp.intersect(tempMiDF, tempMore); - expect(result.toString()).assertEqual("[35, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_010 - * @tc.name : testIntersect010 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersect010", 0, function () { - let result = rangeHp.intersect(tempLower, tempUpper); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_INTERSECT_THROE_ERROR_001 - * @tc.name : testIntersectThrowError001 - * @tc.desc : Returns the intersection of the current range and the range specified by - the given lower and upper bounds. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIntersectThrowError001", 0, function () { - try { - let result = rangeHp.intersect(tempMiDF, 123); - expect(result.toString()).assertEqual("[35, 39]"); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be ScopeType"); - } - }); - - /** - * @tc.number: TEST_GET_UPPER_001 - * @tc.name : testGetUpper001 - * @tc.desc : Obtains the upper bound of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetUpper001", 0, function () { - let result = rangeHp.getUpper(); - expect(result.toString()).assertEqual("40"); - }); - - /** - * @tc.number: TEST_GET_UPPER_002 - * @tc.name : testGetUpper002 - * @tc.desc : Obtains the upper bound of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetUpper002", 0, function () { - let result = rangeHpFir.getUpper(); - expect(result.toString()).assertEqual("39"); - }); - - /** - * @tc.number: TEST_GET_UPPER_003 - * @tc.name : testGetUpper003 - * @tc.desc : Obtains the upper bound of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetUpper003", 0, function () { - let result = rangeHpSec.getUpper(); - expect(result.toString()).assertEqual("45"); - }); - - /** - * @tc.number: TEST_GET_UPPER_004 - * @tc.name : testGetUpper004 - * @tc.desc : Obtains the upper bound of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetUpper004", 0, function () { - let result = rangeHpThi.getUpper(); - expect(result.toString()).assertEqual("35"); - }); - - /** - * @tc.number: TEST_GET_UPPER_005 - * @tc.name : testGetUpper005 - * @tc.desc : Obtains the upper bound of the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetUpper005", 0, function () { - let result = rangeHpFif.getUpper(); - expect(result.toString()).assertEqual("45"); - }); - - /** - * @tc.number: TEST_EXPAND_001 - * @tc.name : testExpand001 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand001", 0, function () { - let result = rangeHp.expand(rangeHpFir); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_002 - * @tc.name : testExpand002 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand002", 0, function () { - let result = rangeHp.expand(rangeHpSec); - expect(result.toString()).assertEqual("[20, 45]"); - }); - - /** - * @tc.number: TEST_EXPAND_003 - * @tc.name : testExpand003 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand003", 0, function () { - let result = rangeHp.expand(rangeHpThi); - expect(result.toString()).assertEqual("[20, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_004 - * @tc.name : testExpand004 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand004", 0, function () { - let result = rangeHp.expand(rangeHpFif); - expect(result.toString()).assertEqual("[30, 45]"); - }); - - /** - * @tc.number: TEST_EXPAND_005 - * @tc.name : testExpand005 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand005", 0, function () { - let result = rangeHp.expand(rangeHp); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_006 - * @tc.name : testExpand006 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand006", 0, function () { - let result = rangeHp.expand(tempMiDF); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_007 - * @tc.name : testExpand007 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand007", 0, function () { - let result = rangeHp.expand(tempLess); - expect(result.toString()).assertEqual("[20, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_008 - * @tc.name : testExpand008 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand008", 0, function () { - let result = rangeHp.expand(tempMore); - expect(result.toString()).assertEqual("[30, 45]"); - }); - - /** - * @tc.number: TEST_EXPAND_009 - * @tc.name : testExpand009 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand009", 0, function () { - let result = rangeHp.expand(tempLower); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_EXPAND_010 - * @tc.name : testExpand010 - * @tc.desc : Creates the smallest range that includes the current range and a given range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testExpand010", 0, function () { - let result = rangeHp.expand(tempUpper); - expect(result.toString()).assertEqual("[30, 40]"); - }); - - /** - * @tc.number: TEST_CONTAINS_001 - * @tc.name : testContains001 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains001", 0, function () { - let result = rangeHp.contains(tempLess); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONTAINS_002 - * @tc.name : testContains002 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains002", 0, function () { - let result = rangeHp.contains(tempMiDF); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_CONTAINS_003 - * @tc.name : testContains003 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains003", 0, function () { - let result = rangeHp.contains(tempMore); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONTAINS_004 - * @tc.name : testContains004 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains004", 0, function () { - let result = rangeHp.contains(tempLower); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_CONTAINS_005 - * @tc.name : testContains005 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains005", 0, function () { - let result = rangeHp.contains(tempUpper); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_CONTAINS_006 - * @tc.name : testContains006 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains006", 0, function () { - let result = rangeHp.contains(rangeHpFir); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_CONTAINS_007 - * @tc.name : testContains007 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains007", 0, function () { - let result = rangeHp.contains(rangeHpSec); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONTAINS_008 - * @tc.name : testContains008 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains008", 0, function () { - let result = rangeHp.contains(rangeHpThi); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONTAINS_009 - * @tc.name : testContains009 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains009", 0, function () { - let result = rangeHp.contains(rangeHpFif); - expect(result).assertEqual(false); - }); - - /** - * @tc.number: TEST_CONTAINS_010 - * @tc.name : testContains010 - * @tc.desc : Checks whether a given value is within the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testContains010", 0, function () { - let result = rangeHp.contains(rangeHp); - expect(result).assertEqual(true); - }); - - /** - * @tc.number: TEST_CLAMP_001 - * @tc.name : testClamp001 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClamp001", 0, function () { - let result = rangeHp.clamp(tempLess); - expect(result.toString()).assertEqual("30"); - }); - - /** - * @tc.number: TEST_CLAMP_002 - * @tc.name : testClamp002 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClamp002", 0, function () { - let result = rangeHp.clamp(tempMiDF); - expect(result.toString()).assertEqual("35"); - }); - - /** - * @tc.number: TEST_CLAMP_003 - * @tc.name : testClamp003 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClamp003", 0, function () { - let result = rangeHp.clamp(tempMore); - expect(result.toString()).assertEqual("40"); - }); - - /** - * @tc.number: TEST_CLAMP_004 - * @tc.name : testClamp004 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClamp004", 0, function () { - let result = rangeHp.clamp(tempLower); - expect(result.toString()).assertEqual("30"); - }); - - /** - * @tc.number: TEST_CLAMP_005 - * @tc.name : testClamp005 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClamp005", 0, function () { - let result = rangeHp.clamp(tempUpper); - expect(result.toString()).assertEqual("40"); - }); - - /** - * @tc.number: TEST_CLAMP_THROW_ERROR_001 - * @tc.name : testClampThrowError001 - * @tc.desc : Clamps a given value to the current range. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testClampThrowError001", 0, function () { - try { - let result = rangeHp.clamp(123); - expect(result.toString()).assertEqual("30"); - } catch (e) { - expect(e.toString()).assertEqual("BusinessError: Parameter error.The type of 123 must be object"); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_001 - * @tc.name : testEncodeSyncBase64001 - * @tc.desc : Encodes all bytes from the specified u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64001", 0, function () { - let that = new util.Base64Helper(); - expect(that != null).assertTrue(); - let array = new Uint8Array([115, 49, 51]); - let rarray = new Uint8Array([99, 122, 69, 122]); - let result = that.encodeSync(array); - for (let i = 0; i < 4; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_002 - * @tc.name : testEncodeSyncBase64002 - * @tc.desc : Encodes all bytes from the specified u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64002", 0, function () { - let that = new util.Base64Helper(); - expect(that != null).assertTrue(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let result = that.encodeSync(array); - for (let i = 0; i < 20; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_003 - * @tc.name : testEncodeSyncBase64003 - * @tc.desc : Encodes all bytes from the specified u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64003", 0, function () { - let that = new util.Base64Helper(); - expect(that != null).assertTrue(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 86, 117, 89, 50, 57, 107, 97, 87, 53, 110, 73, 71, 108, 117, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let result = that.encodeSync(array); - for (let i = 0; i < 36; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_004 - * @tc.name : testEncodeSyncBase64004 - * @tc.desc : Encodes all bytes from the specified u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64004", 0, function () { - let that = new util.Base64Helper(); - expect(that != null).assertTrue(); - let array = new Uint8Array([168, 174, 155, 255]); - let rarray = new Uint8Array([113, 75, 54, 98, 47, 119, 61, 61]); - let result = that.encodeSync(array); - for (let i = 0; i < 8; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_005 - * @tc.name : testEncodeSyncBase64005 - * @tc.desc : Encodes all bytes from the specified u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64005", 0, function () { - let that = new util.Base64Helper(); - expect(that != null).assertTrue(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - let result = that.encodeSync(array); - for (let i = 0; i < 8; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_SYNC_BASE64_001 - * @tc.name : testEncodeToStringSyncBase64001 - * @tc.desc : Encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringSyncBase64001", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([115, 49, 51]); - let result = that.encodeToStringSync(array); - expect(result).assertEqual("czEz"); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_SYNC_BASE64_002 - * @tc.name : testEncodeToStringSyncBase64002 - * @tc.desc : Encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringSyncBase64002", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.encodeToStringSync(array); - expect(result).assertEqual("QmFzZTY0IE5vZGUuanM="); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_SYNC_BASE64_003 - * @tc.name : testEncodeToStringSyncBase64003 - * @tc.desc : Encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringSyncBase64003", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.encodeToStringSync(array); - expect(result).assertEqual("QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM="); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_SYNC_BASE64_004 - * @tc.name : testEncodeToStringSyncBase64004 - * @tc.desc : Encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringSyncBase64004", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([168, 174, 155, 255]); - let result = that.encodeToStringSync(array); - expect(result).assertEqual("qK6b/w=="); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_SYNC_BASE64_005 - * @tc.name : testEncodeToStringSyncBase64005 - * @tc.desc : Encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringSyncBase64005", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52]); - let result = that.encodeToStringSync(array); - expect(result).assertEqual("QmFzZTY0"); - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_001 - * @tc.name : testDecodeSyncBase64001 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64001", 0, function () { - let that = new util.Base64Helper(); - let buff = "czEz"; - let rarray = new Uint8Array([115, 49, 51]); - let result = that.decodeSync(buff); - for (let i = 0; i < 3; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_002 - * @tc.name : testDecodeSyncBase64002 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64002", 0, function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0IE5vZGUuanM="; - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.decodeSync(buff); - for (let i = 0; i < 14; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_003 - * @tc.name : testDecodeSyncBase64003 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64003", 0, function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM="; - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.decodeSync(buff); - for (let i = 0; i < 26; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_004 - * @tc.name : testDecodeSyncBase64004 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64004", 0, function () { - let that = new util.Base64Helper(); - let buff = "qK6b/w=="; - let rarray = new Uint8Array([168, 174, 155, 255]); - let result = that.decodeSync(buff); - for (let i = 0; i < 4; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_005 - * @tc.name : testDecodeSyncBase64005 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64005", 0, function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0"; - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - let result = that.decodeSync(buff); - for (let i = 0; i < 6; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_006 - * @tc.name : testDecodeSyncBase64006 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64006", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.decodeSync(array); - for (let i = 0; i < 14; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_007 - * @tc.name : testDecodeSyncBase64007 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64007", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 86, 117, 89, 50, 57, 107, 97, 87, 53, 110, 73, 71, 108, 117, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - let result = that.decodeSync(array); - for (let i = 0; i < 26; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_008 - * @tc.name : testDecodeSyncBase64008 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64008", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([113, 75, 54, 98, 47, 119, 61, 61]); - let rarray = new Uint8Array([168, 174, 155, 255]); - let result = that.decodeSync(array); - for (let i = 0; i < 4; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_DECODE_SYNC_BASE64_009 - * @tc.name : testDecodeSyncBase64009 - * @tc.desc : Decodes a Base64 encoded String or input u8 array into a newly-allocated u8 - array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeSyncBase64009", 0, function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - let result = that.decodeSync(array); - for (let i = 0; i < 6; i++) { - expect(result[i]).assertEqual(rarray[i]); - } - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_001 - * @tc.name : testEncodeSyncBase64001 - * @tc.desc : Asynchronously encodes all bytes in the specified u8 array into the newly - allocated u8 array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64001", 0, async function () { - let that = await new util.Base64Helper(); - let array = new Uint8Array([115, 49, 51]); - let rarray = new Uint8Array([99, 122, 69, 122]); - that.encode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_002 - * @tc.name : testEncodeSyncBase64002 - * @tc.desc : Asynchronously encodes all bytes in the specified u8 array into the newly - allocated u8 array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64002", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - that.encode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_003 - * @tc.name : testEncodeSyncBase64003 - * @tc.desc : Asynchronously encodes all bytes in the specified u8 array into the newly - allocated u8 array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64003", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 86, 117, 89, 50, 57, 107, 97, 87, 53, 110, 73, 71, 108, 117, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - that.encode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_004 - * @tc.name : testEncodeSyncBase64004 - * @tc.desc : Asynchronously encodes all bytes in the specified u8 array into the newly - allocated u8 array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64004", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([168, 174, 155, 255]); - let rarray = new Uint8Array([113, 75, 54, 98, 47, 119, 61, 61]); - that.encode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_ENCODE_SYNC_BASE64_005 - * @tc.name : testEncodeSyncBase64005 - * @tc.desc : Asynchronously encodes all bytes in the specified u8 array into the newly - allocated u8 array using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeSyncBase64005", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52]); - let rarray = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - that.encode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_BASE64_001 - * @tc.name : testEncodeToStringBase64001 - * @tc.desc : Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringBase64001", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([115, 49, 51]); - that.encodeToString(array).then((val) => { - expect(val).assertEqual("czEz"); - }); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_BASE64_002 - * @tc.name : testEncodeToStringBase64002 - * @tc.desc : Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringBase64002", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.encodeToString(array).then((val) => { - expect(val).assertEqual("QmFzZTY0IE5vZGUuanM="); - }); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_BASE64_003 - * @tc.name : testEncodeToStringBase64003 - * @tc.desc : Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringBase64003", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 86, 117, 89, 50, 57, 107, 97, 87, 53, 110, 73, 71, 108, 117, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - that.encodeToString(array).then((val) => { - expect(val).assertEqual("QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM="); - }); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_BASE64_004 - * @tc.name : testEncodeToStringBase64004 - * @tc.desc : Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringBase64004", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([168, 174, 155, 255]); - that.encodeToString(array).then((val) => { - expect(val).assertEqual("qK6b/w=="); - }); - }); - - /** - * @tc.number: TEST_ENCODE_TO_STRING_BASE64_005 - * @tc.name : testEncodeToStringBase64005 - * @tc.desc : Asynchronously encodes the specified byte array into a String using the Base64 encoding scheme. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEncodeToStringBase64005", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.encodeToString(array).then((val) => { - expect(val).assertEqual("QmFzZTY0"); - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_001 - * @tc.name : testDecodeBase64001 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64001", 0, async function () { - let that = new util.Base64Helper(); - let buff = "czEz"; - let array = new Uint8Array([115, 49, 51]); - that.decode(buff).then((val) => { - for (let i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_002 - * @tc.name : testDecodeBase64002 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64002", 0, async function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0IE5vZGUuanM="; - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decode(buff).then((val) => { - for (let i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_003 - * @tc.name : testDecodeBase64003 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64003", 0, async function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0IEVuY29kaW5nIGluIE5vZGUuanM="; - let array = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decode(buff).then((val) => { - for (let i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_004 - * @tc.name : testDecodeBase64004 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64004", 0, async function () { - let that = new util.Base64Helper(); - let buff = "qK6b/w=="; - let array = new Uint8Array([168, 174, 155, 255]); - that.decode(buff).then((val) => { - for (let i = 0; i < array.length; i++) { - expect(val[i]).assertEqual(array[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_005 - * @tc.name : testDecodeBase64005 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64005", 0, async function () { - let that = new util.Base64Helper(); - let buff = "QmFzZTY0"; - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.decode(buff).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_006 - * @tc.name : testDecodeBase64006 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64006", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([99, 122, 69, 122]); - let rarray = new Uint8Array([115, 49, 51]); - that.decode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_007 - * @tc.name : testDecodeBase64007 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64007", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_008 - * @tc.name : testDecodeBase64008 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64008", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48, 73, 69, 86, 117, 89, 50, 57, 107, 97, 87, 53, 110, 73, 71, 108, 117, 73, 69, 53, 118, 90, 71, 85, 117, 97, 110, 77, 61]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52, 32, 69, 110, 99, 111, 100, 105, 110, 103, 32, 105, 110, 32, 78, 111, 100, 101, 46, 106, 115]); - that.decode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_009 - * @tc.name : testDecodeBase64009 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64009", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([113, 75, 54, 98, 47, 119, 61, 61]); - let rarray = new Uint8Array([168, 174, 155, 255]); - that.decode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - - /** - * @tc.number: TEST_DECODE_BASE64_010 - * @tc.name : testDecodeBase64010 - * @tc.desc : Use the Base64 encoding scheme to asynchronously decode a Base64-encoded string or input u8 - array into a newly allocated u8 array. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testDecodeBase64010", 0, async function () { - let that = new util.Base64Helper(); - let array = new Uint8Array([81, 109, 70, 122, 90, 84, 89, 48]); - let rarray = new Uint8Array([66, 97, 115, 101, 54, 52]); - that.decode(array).then((val) => { - for (let i = 0; i < rarray.length; i++) { - expect(val[i]).assertEqual(rarray[i]); - } - }); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryutiletstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/app.json b/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/app.json deleted file mode 100644 index 6f58491ddf9cf37996ed945d57fa0afa03cb7b4e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/app.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "app": { - "bundleName": "ohos.acts.commonlibrary.crossplatform.convertxml.normal", - "vendor": "example", - "versionCode": 1000000, - "versionName": "1.0.0", - "icon": "$media:app_icon", - "label": "$string:app_name", - "minAPIVersion": 10, - "targetAPIVersion": 10, - "car": { - "apiCompatibleVersion": 10, - "singleUser": false - } - } -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/element/string.json deleted file mode 100644 index 3811bc441fc0f128eb4d14c53ed463ffb8dc3811..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "xtsDemo1" - } - ] -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/media/app_icon.png b/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryxmletstest/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/BUILD.gn b/commonlibrary/crossplatform/commonlibraryxmletstest/BUILD.gn deleted file mode 100644 index 1e30153a2d877b38d6d156e452c2c9b1f90fd920..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/BUILD.gn +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (C) 2023 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. -import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsCrossplatformXmlTest") { - hap_profile = "src/main/module.json" - deps = [ - ":windowStage_js_assets", - ":windowStage_resources", - ] - ets2abc = true - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsCrossplatformXmlTest" - subsystem_name = "commonlibrary" - part_name = "ets_utils" -} -ohos_app_scope("windowStage_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} -ohos_js_assets("windowStage_js_assets") { - source_dir = "src/main/ets" -} -ohos_resources("windowStage_resources") { - sources = [ "src/main/resources" ] - deps = [ ":windowStage_app_profile" ] - hap_profile = "src/main/module.json" -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/Test.json b/commonlibrary/crossplatform/commonlibraryxmletstest/Test.json deleted file mode 100644 index b15bd1dafb815348e298a12382abda6e2242bf53..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/Test.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "60000", - "shell-timeout": "60000", - "bundle-name": "ohos.acts.commonlibrary.crossplatform.convertxml.normal", - "module-name": "entry_test" - }, - "kits": [ - { - "test-file-name": [ - "ActsCrossplatformXmlTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/signature/openharmony_sx.p7b b/commonlibrary/crossplatform/commonlibraryxmletstest/signature/openharmony_sx.p7b deleted file mode 100644 index 8010658c7b88ccff37fc93c9b64ef835aa4f168a..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryxmletstest/signature/openharmony_sx.p7b and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/TestAbility.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/TestAbility.ets deleted file mode 100644 index a535e83f79f890b0209acbfa7d873fd4de72104b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/TestAbility.ets +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import UIAbility from '@ohos.app.ability.UIAbility'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; -import hilog from '@ohos.hilog'; -import { Hypium } from '@ohos/hypium'; -import testsuite from '../test/List.test'; -import window from '@ohos.window'; - -export default class TestAbility extends UIAbility { - onCreate(want, launchParam) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); - hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); - hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - onDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); - } - - onWindowStageCreate(windowStage: window.WindowStage) { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); - windowStage.loadContent('TestAbility/pages/Index', (err, data) => { - if (err.code) { - hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); - return; - } - hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', - JSON.stringify(data) ?? ''); - }); - } - - onWindowStageDestroy() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); - } - - onForeground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); - } - - onBackground() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/pages/Index.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/pages/Index.ets deleted file mode 100644 index dbc536ca80c5095e2bcb95bdf9ce4659ea973139..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestAbility/pages/Index.ets +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import hilog from '@ohos.hilog'; - -@Entry -@Component -struct Index { - aboutToAppear() { - hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); - } - @State message: string = 'Hello World' - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .width('35%') - .height('5%') - .onClick(()=>{ - }) - } - .width('100%') - } - .height('100%') - } - } \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index 92a16d84e8870da219c51d9f1342c79203c1f42d..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,49 +0,0 @@ -import hilog from '@ohos.hilog'; -import TestRunner from '@ohos.application.testRunner'; -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -async function onAbilityCreateCallback() { - hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); -} - -async function addAbilityMonitorCallback(err: any) { - hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); - } - - async onRun() { - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility' - let lMonitor = { - abilityName: testAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName - var debug = abilityDelegatorArguments.parameters['-D'] - if (debug == 'true') - { - cmd += ' -D' - } - hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); - hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); - }) - hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); - } -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/List.test.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/List.test.ets deleted file mode 100644 index 09c4f9aa154a60500cfe90fc233265d0d51dbc62..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import xmlTest from './xml.test' -import xmlParseOptionTest from './xmlEventType.test' -import xmlEventTypeTest from './xmlParseOption.test' - -export default function testsuite() { - xmlTest(); - xmlParseOptionTest(); - xmlEventTypeTest(); -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xml.test.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xml.test.ets deleted file mode 100644 index 6aebddc1d74c893c327927387d41be93ef56212f..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xml.test.ets +++ /dev/null @@ -1,1667 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect, -} from "@ohos/hypium"; -import xml from "@ohos.xml"; -import util from "@ohos.util"; -export default function XmlSerializerXmlPullParserTest() { - describe("XmlSerializerXmlPullParserTest", function () { - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Create an xml instance. For example: let xml = new xml.XmlSerializer(arrayBuffer). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - try { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - expect(thatSer != null).assertEqual(true); - } catch (err) { - console.log("testConstructor001 meet error: " + err); - } - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_002 - * @tc.name : testConstructor002 - * @tc.desc : Create an xml instance. For example: let xml = new xml.XmlSerializer(arrayBuffer, encoding). - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor002", 0, function () { - try { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer, "utf-8"); - expect(thatSer != null).assertEqual(true); - } catch (err) { - console.log("testConstructor001 meet error: " + err); - } - }); - - /** - * @tc.number: TEST_SET_ATTRIBUTES_001 - * @tc.name : testsetAttributes001 - * @tc.desc : Write an attribute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAttributes001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance1", "high1"); - thatSer.endElement(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_ATTRIBUTES_002 - * @tc.name : testsetAttributes002 - * @tc.desc : Write an attribute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAttributes002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance1", "high1"); - thatSer.setAttributes("importance2", "high2"); - thatSer.endElement(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_ATTRIBUTES_003 - * @tc.name : testsetAttributes003 - * @tc.desc : Write an attribute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAttributes003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance1", "high1"); - thatSer.setAttributes("importance2", "high2"); - thatSer.setAttributes("importance3", "high3"); - thatSer.endElement(); - var result = - ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_ATTRIBUTES_004 - * @tc.name : testsetAttributes004 - * @tc.desc : Write an attribute. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetAttributes004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance1", "high1"); - thatSer.setAttributes("importance2", "high2"); - thatSer.setAttributes("importance3", "high3"); - thatSer.setAttributes("importance4", "high4"); - thatSer.endElement(); - var result = - ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_ADD_EMPTY_ELEMENT_001 - * @tc.name : testAddEmptyElement001 - * @tc.desc : Add an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddEmptyElement001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.addEmptyElement("a"); - thatSer.endElement(); - var result = "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_ADD_EMPTY_ELEMENT_002 - * @tc.name : testAddEmptyElement002 - * @tc.desc : Add an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddEmptyElement002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.endElement(); - thatSer.addEmptyElement("b"); - var result = "\r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_ADD_EMPTY_ELEMENT_003 - * @tc.name : testAddEmptyElement003 - * @tc.desc : Add an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddEmptyElement003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.addEmptyElement("c"); - thatSer.startElement("note"); - thatSer.endElement(); - var result = "\r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_ADD_EMPTY_ELEMENT_004 - * @tc.name : testAddEmptyElement004 - * @tc.desc : Add an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddEmptyElement004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.addEmptyElement("d"); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_ADD_EMPTY_ELEMENT_005 - * @tc.name : testAddEmptyElement005 - * @tc.desc : Add an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testAddEmptyElement005", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.addEmptyElement("c"); - thatSer.addEmptyElement("d"); - thatSer.endElement(); - var result = "\r\n \r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DECLARATION_001 - * @tc.name : testSetDeclaration001 - * @tc.desc : Writes xml declaration with encoding. For example: . - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDeclaration001", 0, function () { - var arrayBuffer = new ArrayBuffer(2048); - var thatSer = new xml.XmlSerializer(arrayBuffer, "utf-8"); - thatSer.setDeclaration(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_START_ELEMENT_001 - * @tc.name : testStartElement001 - * @tc.desc : Writes an elemnet start tag with the given name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testStartElement001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.endElement(); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_START_ELEMENT_002 - * @tc.name : testStartElement002 - * @tc.desc : Writes an elemnet start tag with the given name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testStartElement002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.endElement(); - thatSer.startElement("note2"); - thatSer.endElement(); - var result = "\r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_START_ELEMENT_003 - * @tc.name : testStartElement003 - * @tc.desc : Writes an elemnet start tag with the given name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testStartElement003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.startElement("note2"); - thatSer.endElement(); - thatSer.endElement(); - var result = "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_START_ELEMENT_004 - * @tc.name : testStartElement004 - * @tc.desc : Writes an elemnet start tag with the given name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testStartElement004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.startElement("note2"); - thatSer.startElement("note3"); - thatSer.endElement(); - thatSer.endElement(); - thatSer.endElement(); - var result = - "\r\n \r\n \r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_START_ELEMENT_005 - * @tc.name : testStartElement005 - * @tc.desc : Writes an elemnet start tag with the given name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testStartElement005", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.startElement("note2"); - thatSer.endElement(); - thatSer.startElement("note3"); - thatSer.endElement(); - thatSer.endElement(); - var result = "\r\n \r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_END_ELEMENT_001 - * @tc.name : testEndElement001 - * @tc.desc : Writes end tag of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEndElement001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.endElement(); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_END_ELEMENT_002 - * @tc.name : testEndElement002 - * @tc.desc : Writes end tag of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEndElement002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance", "high"); - thatSer.endElement(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_END_ELEMENT_003 - * @tc.name : testEndElement003 - * @tc.desc : Writes end tag of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEndElement003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("impo", "hi"); - thatSer.endElement(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_END_ELEMENT_004 - * @tc.name : testEndElement004 - * @tc.desc : Writes end tag of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEndElement004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note1"); - thatSer.startElement("note2"); - thatSer.endElement(); - thatSer.endElement(); - var result = "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_END_ELEMENT_005 - * @tc.name : testEndElement005 - * @tc.desc : Writes end tag of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testEndElement005", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note2"); - thatSer.setAttributes("importance", "high"); - thatSer.endElement(); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_NAMESPECE_001 - * @tc.name : testSetNamespace001 - * @tc.desc : Writes the namespace of the current element tag. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetNamespace001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDeclaration(); - thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); - thatSer.startElement("note"); - thatSer.endElement(); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_NAMESPECE_002 - * @tc.name : testSetNamespace002 - * @tc.desc : Writes the namespace of the current element tag. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetNamespace002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDeclaration(); - thatSer.setNamespace("b", "http://www.w3.org/TR/html4/"); - thatSer.startElement("note"); - thatSer.endElement(); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_NAMESPECE_003 - * @tc.name : testSetNamespace003 - * @tc.desc : Writes the namespace of the current element tag. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetNamespace003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDeclaration(); - thatSer.setNamespace("h", "http://www.111/"); - thatSer.startElement("note"); - thatSer.endElement(); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_NAMESPECE_004 - * @tc.name : testSetNamespace004 - * @tc.desc : Writes the namespace of the current element tag. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetNamespace004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDeclaration(); - thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); - thatSer.startElement("note1"); - thatSer.startElement("note2"); - thatSer.endElement(); - thatSer.endElement(); - var result = - '\r\n' + - "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_COMMENT_001 - * @tc.name : testSetComment001 - * @tc.desc : Writes the comment. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetComment001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setComment("Hi!"); - thatSer.endElement(); - var result = "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_COMMENT_002 - * @tc.name : testSetComment002 - * @tc.desc : Writes the comment. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetComment002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setComment("Hello, World!"); - thatSer.endElement(); - var result = "\r\n \r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_COMMENT_003 - * @tc.name : testSetComment003 - * @tc.desc : Writes the comment. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetComment003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setComment("Hello, World!"); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_COMMENT_005 - * @tc.name : testSetComment005 - * @tc.desc : Writes the comment. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetComment004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setComment("Hello, World!"); - thatSer.startElement("note"); - thatSer.endElement(); - var result = "\r\n"; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_CDATA_001 - * @tc.name : testSetCDATA001 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetCDATA001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setCDATA("root SYSTEM"); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_CDATA_002 - * @tc.name : testSetCDATA002 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetCDATA002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"'); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_CDATA_003 - * @tc.name : testSetCDATA003 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetCDATA003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.endElement(); - thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"'); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_CDATA_004 - * @tc.name : testSetCDATA004 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetCDATA004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"'); - thatSer.startElement("note"); - thatSer.endElement(); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_CDATA_005 - * @tc.name : testSetCDATA005 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetCDATA005", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setCDATA('root SYSTEM "http://www.test.org/test.dtd"'); - thatSer.endElement(); - var result = - '\r\n \r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_TEXT_001 - * @tc.name : testSetText001 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetText001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance", "high"); - thatSer.setText("Happy1"); - thatSer.endElement(); - var result = 'Happy1'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_TEXT_002 - * @tc.name : testSetText002 - * @tc.desc : Writes the CDATA. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetText002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setAttributes("importance", "high"); - thatSer.setText("Happy2"); - thatSer.endElement(); - var result = 'Happy2'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DOC_TYPE_001 - * @tc.name : testSetDocType001 - * @tc.desc : Writes the DOCTYPE. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDocType001", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDocType("root SYSTEM"); - var result = ""; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DOC_TYPE_002 - * @tc.name : testSetDocType002 - * @tc.desc : Writes the DOCTYPE. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDocType002", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDocType('root SYSTEM "http://www.test.org/test.dtd"'); - var result = ''; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DOC_TYPE_003 - * @tc.name : testSetDocType003 - * @tc.desc : Writes the DOCTYPE. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDocType003", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.endElement(); - thatSer.setDocType('root SYSTEM "http://www.test.org/test.dtd"'); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DOC_TYPE_004 - * @tc.name : testSetDocType004 - * @tc.desc : Writes the DOCTYPE. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDocType004", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.setDocType('root SYSTEM "http://www.test.org/test.dtd"'); - thatSer.startElement("note"); - thatSer.endElement(); - var result = - '\r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_SET_DOC_TYPE_005 - * @tc.name : testSetDocType005 - * @tc.desc : Writes the DOCTYPE. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testSetDocType005", 0, function () { - const myMAX = 2048; - var arrayBuffer = new ArrayBuffer(myMAX); - var thatSer = new xml.XmlSerializer(arrayBuffer); - thatSer.startElement("note"); - thatSer.setDocType('root SYSTEM "http://www.test.org/test.dtd"'); - thatSer.endElement(); - var result = - '\r\n \r\n'; - var view = new Uint8Array(arrayBuffer); - var view1 = ""; - for (var i = 0; i < result.length; ++i) { - view1 = view1 + String.fromCodePoint(view[i]); - } - expect(view1).assertEqual(result); - }); - - /** - * @tc.number: TEST_GET_COLUMN_NUMBER_001 - * @tc.name : testGetColumnNumber001 - * @tc.desc : Get the current column number, starting from 1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetColumnNumber001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getColumnNumber(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:1key:2 value:77key:10 value:81key:2 value:88key:4 value:93key:3 value:101" + - "key:3 value:108key:1 value:215"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_DEPTH_001 - * @tc.name : testGetDepth001 - * @tc.desc : Gets the current depth of the element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetDepth001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getDepth(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:0key:2 value:1key:10 value:1key:2 value:2key:4 value:2key:3 value:2key:3 value:1key:1 value:0"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_LINE_NUMBER_001 - * @tc.name : testGetLineNumber001 - * @tc.desc : Get the current line number, starting from 1. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetLineNumber001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getLineNumber(); - str += arrTag[i]; - i++; - return true; - } - - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:1key:2 value:1key:10 value:1key:2 value:1key:4 value:1key:3 value:1key:3 value:1key:1 value:1"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_NAME_001 - * @tc.name : testGetName001 - * @tc.desc : Gets the current element name. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetName001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getName(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:key:2 value:notekey:10 value:key:2 value:titlekey:4 value:key:3 value:titlekey:3 value:notekey:1 value:"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_NAME_SPACE_001 - * @tc.name : testGetNamespace001 - * @tc.desc : Gets the namespace of the current element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetNamespace001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getNamespace(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:key:2 value:key:10 value:key:2 value:key:4 value:key:3 value:key:3 value:key:1 value:"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_PREFIX_001 - * @tc.name : testGetPrefix001 - * @tc.desc : Gets the namespace of the current element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetPrefix001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getPrefix(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:key:2 value:key:10 value:key:2 value:key:4 value:key:3 value:key:3 value:key:1 value:"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_TEXT_001 - * @tc.name : testGetText001 - * @tc.desc : Gets the text content of the current event. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetText001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getText(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:key:2 value:key:10 value: key:2 value:key:4 value:Happykey:3 value:key:3 value:key:1 value:"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_IS_EMPTY_ELEMENT_001 - * @tc.name : testIsEmptyElementTag001 - * @tc.desc : Determine whether the current element is an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsEmptyElementTag001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.isEmptyElementTag(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:falsekey:2 value:falsekey:10 value:falsekey:2 value:falsekey:4 value:falsekey:3 value:falsekey:3 value:falsekey:1 value:false"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_IS_WHITE_SPACE_001 - * @tc.name : testIsWhitespace001 - * @tc.desc : Determine whether the current element is an empty element. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testIsWhitespace001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.isWhitespace(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:truekey:2 value:falsekey:10 value:truekey:2 value:truekey:4 value:falsekey:3 value:truekey:3 value:truekey:1 value:true"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_GET_ATTRIBUTE_COUNT_001 - * @tc.name : testGetAttributeCount001 - * @tc.desc : Gets the number of attributes for the current start tag. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testGetAttributeCount001", 0, function () { - let strXml = - '' + - '' + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let arrTag = {}; - let str = ""; - let i = 0; - function func(key, value) { - arrTag[i] = "key:" + key + " value:" + value.getAttributeCount(); - str += arrTag[i]; - i++; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - const expectResult = - "key:0 value:0key:2 value:2key:10 value:0key:2 value:0key:4 value:0key:3 value:0key:3 value:0key:1 value:0"; - expect(expectResult == str).assertTrue(); - }); - - /** - * @tc.number: TEST_CONSTRUCTOR_001 - * @tc.name : testConstructor001 - * @tc.desc : Construct and return an XmlPullParser object. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testConstructor001", 0, function () { - let strXml = - '' + - ']>' + - '' + - " " + - " " + - " John & Hans" + - " Happy" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer, "UTF-8"); - let str = ""; - function func1(name, value) { - str += name + ":" + value; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tagValueCallbackFunction: func1, - }; - that.parse(options); - const expectResult = - ':: note []note:: :funcrion matchwo(a,6){return 1;}: :Hello, World!: company::John amp;:amp;: Hanscompany:: title::Happytitle:note::'; - expect(expectResult == str).assertTrue(); - }); - /** - * @tc.number: TEST_PARSE_001 - * @tc.name : testParse001 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParse001", 0, function () { - var strXml = - '' + - ']>' + - '' + - " " + - " " + - " John & Hans" + - " Happy" + - " Happy" + - " Work" + - " Play" + - " " + - " " + - ' ' + - " " + - " Apples" + - " Bananas" + - " " + - " " + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer, "UTF-8"); - var str = ""; - function func2(name, value) { - str += name + ":" + value; - return true; - } - var options = { - supportDoctype: true, - ignoreNameSpace: true, - attributeValueCallbackFunction: func2, - }; - that.parse(options); - var str1 = - "importance:highlogged:truexmlns:h:http://www.w3.org/TR/html4/"; - expect(str).assertEqual(str1); - }); - - /** - * @tc.number: TEST_PARSE_002 - * @tc.name : testParse002 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParse002", 0, function () { - var strXml = - '' + - ']>' + - '' + - " " + - " " + - " John & Hans" + - " Happy" + - " Happy" + - " Work" + - " Play" + - " " + - " " + - ' ' + - " " + - " Apples" + - " Bananas" + - " " + - " " + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - var str1 = ""; - function func1(name, value) { - str1 += name + value + " "; - return true; - } - var options = { - supportDoctype: true, - ignoreNameSpace: true, - tagValueCallbackFunction: func1, - }; - that.parse(options); - var str3 = - ' note [] note funcrion matchwo(a,6){return 1;} Hello, World! ' + - "company John amp;amp; Hans company title Happy title title Happy title " + - "lens Work lens lens Play lens go there a b b a h:table " + - "h:tr h:td Apples h:td h:td Bananas h:td h:tr " + - "h:table note "; - expect(str1).assertEqual(str3); - }); - - /** - * @tc.number: TEST_PARSE_003 - * @tc.name : testParse003 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParse003", 0, function () { - let strXml = - '' + - '' + - " Happy" + - " Work" + - " Play" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let str = ""; - function func(key, value) { - str += "key:" + key + " value:" + value.getColumnNumber() + " "; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - let result = - "key:0 value:1 key:2 value:77 key:10 value:81 key:2 value:88 key:4 value:93 " + - "key:3 value:101 key:10 value:105 key:2 value:111 key:4 value:115 key:3 value:122 key:10 value:126 " + - "key:2 value:132 key:4 value:136 key:3 value:143 key:3 value:150 key:1 value:299 "; - expect(str).assertEqual(result); - }); - - /** - * @tc.number: TEST_PARSE_004 - * @tc.name : testParse004 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParse004", 0, function () { - let strXml = - '' + - '' + - " Happy" + - " Work" + - " Play" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let str = ""; - function func(key, value) { - str += "key:" + key + " value:" + value.getDepth() + " "; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - let result = - "key:0 value:0 key:2 value:1 key:10 value:1 key:2 value:2 key:4 value:2 key:3 value:2 " + - "key:10 value:1 key:2 value:2 key:4 value:2 key:3 value:2 key:10 value:1 key:2 value:2 " + - "key:4 value:2 key:3 value:2 key:3 value:1 key:1 value:0 "; - expect(str).assertEqual(result); - }); - - /** - * @tc.number: TEST_PARSE_005 - * @tc.name : testParse005 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParse005", 0, function () { - let strXml = - '' + - '' + - " Happy" + - " Work" + - " Play" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let str = ""; - function func(key, value) { - str += "key:" + key + " value:" + value.getLineNumber() + " "; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - let result = - "key:0 value:1 key:2 value:1 key:10 value:1 key:2 value:1 key:4 value:1 key:3 value:1 " + - "key:10 value:1 key:2 value:1 key:4 value:1 key:3 value:1 key:10 value:1 key:2 value:1 " + - "key:4 value:1 key:3 value:1 key:3 value:1 key:1 value:1 "; - expect(str).assertEqual(result); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlEventType.test.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlEventType.test.ets deleted file mode 100644 index 50e011231d05eb7ea20882eca239231436f43e6e..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlEventType.test.ets +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect, -} from "@ohos/hypium"; -import xml from "@ohos.xml"; -import util from "@ohos.util"; -export default function XmlSerializerXmlPullParserTest() { - describe("XmlEventTypeTest", function () { - /** - * @tc.number: TEST_START_DOCUMENT_001 - * @tc.name : testSTART_DOCUMENT001 - * @tc.desc : Start file event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testSTART_DOCUMENT001", 0, function () { - var event = xml.EventType.START_DOCUMENT; - expect(event).assertEqual(0); - }); - - /** - * @tc.number: TEST_END_DOCUMENT_001 - * @tc.name : testEND_DOCUMENT001 - * @tc.desc : End file event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testEND_DOCUMENT001", 0, function () { - var event = xml.EventType.END_DOCUMENT; - expect(event).assertEqual(1); - }); - - /** - * @tc.number: TEST_START_TAG_001 - * @tc.name : testSTART_TAG001 - * @tc.desc : Start the tag event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testSTART_TAG001", 0, function () { - var event = xml.EventType.START_TAG; - expect(event).assertEqual(2); - }); - - /** - * @tc.number: TEST_END_TAG_001 - * @tc.name : testEND_TAG001 - * @tc.desc : End tag event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testEND_TAG001", 0, function () { - var event = xml.EventType.END_TAG; - expect(event).assertEqual(3); - }); - - /** - * @tc.number: TEST_TEXT_001 - * @tc.name : testTEXT001 - * @tc.desc : Text event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testTEXT001", 0, function () { - var event = xml.EventType.TEXT; - expect(event).assertEqual(4); - }); - - /** - * @tc.number: TEST_CDSECT_001 - * @tc.name : testCDSECT001 - * @tc.desc : CDATA Event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testCDSECT001", 0, function () { - var event = xml.EventType.CDSECT; - expect(event).assertEqual(5); - }); - - /** - * @tc.number: TEST_COMMENT_001 - * @tc.name : testCOMMENT001 - * @tc.desc : XML comment event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testCOMMENT001", 0, function () { - var event = xml.EventType.COMMENT; - expect(event).assertEqual(6); - }); - - /** - * @tc.number: TEST_DOCDECL_001 - * @tc.name : testDOCDECL001 - * @tc.desc : XML document type declaration event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testDOCDECL001", 0, function () { - var event = xml.EventType.DOCDECL; - expect(event).assertEqual(7); - }); - - /** - * @tc.number: TEST_INSTRUCTION_001 - * @tc.name : testINSTRUCTION001 - * @tc.desc : XML processing instruction declaration event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testINSTRUCTION001", 0, function () { - var event = xml.EventType.INSTRUCTION; - expect(event).assertEqual(8); - }); - - /** - * @tc.number: TEST_ENTITY_REFERENCE_001 - * @tc.name : testENTITY_REFERENCE001 - * @tc.desc : Entity reference event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testENTITY_REFERENCE001", 0, function () { - var event = xml.EventType.ENTITY_REFERENCE; - expect(event).assertEqual(9); - }); - - /** - * @tc.number: TEST_WHITESPACE_001 - * @tc.name : testWHITESPACE001 - * @tc.desc : Blank event. - * @tc.size : MediumTest - * @tc.type : Enum - * @tc.level : Level 0 - */ - it("testWHITESPACE001", 0, function () { - var event = xml.EventType.WHITESPACE; - expect(event).assertEqual(10); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlParseOption.test.ets b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlParseOption.test.ets deleted file mode 100644 index 54b7a7045bb28519d9668af404bf7350ea55f024..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/ets/test/xmlParseOption.test.ets +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2023 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. - */ -import { - describe, - beforeAll, - beforeEach, - afterEach, - afterAll, - it, - expect, -} from "@ohos/hypium"; -import xml from "@ohos.xml"; -import util from "@ohos.util"; -export default function XmlSerializerXmlPullParserTest() { - describe("XmlParseOptionTest", function () { - /** - * @tc.number: TEST_PARSE_OPTION_001 - * @tc.name : testParseOptions001 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParseOptions001", 0, function () { - var strXml = - '' + - ']>' + - '' + - " " + - " " + - " John & Hans" + - " Happy" + - " Happy" + - " Work" + - " Play" + - " " + - " " + - ' ' + - " " + - " Apples" + - " Bananas" + - " " + - " " + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer, "UTF-8"); - var str = ""; - function func2(name, value) { - str += name + ":" + value; - return true; - } - var options = { - supportDoctype: true, - ignoreNameSpace: true, - attributeValueCallbackFunction: func2, - }; - that.parse(options); - var str1 = - "importance:highlogged:truexmlns:h:http://www.w3.org/TR/html4/"; - expect(str).assertEqual(str1); - }); - - /** - * @tc.number: TEST_PARSE_OPTION_002 - * @tc.name : testParseOptions002 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParseOptions002", 0, function () { - var strXml = - '' + - ']>' + - '' + - " " + - " " + - " John & Hans" + - " Happy" + - " Happy" + - " Work" + - " Play" + - " " + - " " + - ' ' + - " " + - " Apples" + - " Bananas" + - " " + - " " + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - var str1 = ""; - function func1(name, value) { - str1 += name + value + " "; - return true; - } - var options = { - supportDoctype: true, - ignoreNameSpace: true, - tagValueCallbackFunction: func1, - }; - that.parse(options); - var str3 = - ' note [] note funcrion matchwo(a,6){return 1;} Hello, World! ' + - "company John amp;amp; Hans company title Happy title title Happy title " + - "lens Work lens lens Play lens go there a b b a h:table " + - "h:tr h:td Apples h:td h:td Bananas h:td h:tr " + - "h:table note "; - expect(str1).assertEqual(str3); - }); - - /** - * @tc.number: TEST_PARSE_OPTION_002 - * @tc.name : testParseOptions002 - * @tc.desc : Starts parsing the XML file. - * @tc.size : MediumTest - * @tc.type : Method - * @tc.level : Level 2 - */ - it("testParseOptions003", 0, function () { - let strXml = - '' + - '' + - " Happy" + - " Work" + - " Play" + - ""; - let textEncoder = new util.TextEncoder(); - let arrbuffer = textEncoder.encodeInto(strXml); - let that = new xml.XmlPullParser(arrbuffer.buffer); - let str = ""; - function func(key, value) { - str += "key:" + key + " value:" + value.getColumnNumber() + " "; - return true; - } - let options = { - supportDoctype: true, - ignoreNameSpace: true, - tokenValueCallbackFunction: func, - }; - that.parse(options); - let result = - "key:0 value:1 key:2 value:77 key:10 value:81 key:2 value:88 key:4 value:93 " + - "key:3 value:101 key:10 value:105 key:2 value:111 key:4 value:115 key:3 value:122 key:10 value:126 " + - "key:2 value:132 key:4 value:136 key:3 value:143 key:3 value:150 key:1 value:299 "; - expect(str).assertEqual(result); - }); - }); -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/module.json b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/module.json deleted file mode 100644 index a4443e713ad997179d4e68fbe682c1969fa541a0..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/module.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "module": { - "name": "entry_test", - "type": "feature", - "description": "$string:module_test_desc", - "mainElement": "TestAbility", - "deviceTypes": [ - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "pages": "$profile:test_pages", - "abilities": [ - { - "name": "TestAbility", - "srcEntry": "./ets/TestAbility/TestAbility.ets", - "description": "$string:TestAbility_desc", - "icon": "$media:icon", - "label": "$string:TestAbility_label", - "exported": true, - "startWindowIcon": "$media:icon", - "startWindowBackground": "$color:start_window_background", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ] - } -} diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/color.json b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/color.json deleted file mode 100644 index 3c712962da3c2751c2b9ddb53559afcbd2b54a02..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/color.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "color": [ - { - "name": "start_window_background", - "value": "#FFFFFF" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/string.json b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/string.json deleted file mode 100644 index 65d8fa5a7cf54aa3943dcd0214f58d1771bc1f6c..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/element/string.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "string": [ - { - "name": "module_test_desc", - "value": "test ability description" - }, - { - "name": "TestAbility_desc", - "value": "the test ability" - }, - { - "name": "TestAbility_label", - "value": "test label" - } - ] -} \ No newline at end of file diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/media/icon.png b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/profile/test_pages.json b/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/profile/test_pages.json deleted file mode 100644 index 77e90731b5a38d861663029b483df3d3ac9ec74b..0000000000000000000000000000000000000000 --- a/commonlibrary/crossplatform/commonlibraryxmletstest/src/main/resources/base/profile/test_pages.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "src": [ - "TestAbility/pages/Index" - ] -}