diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js index 714a48b74dcc0e04c92585729c7152b68db62a00..379e5e59762bf9b956aa156d9a85c35995fe7748 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js +++ b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/ArrayList.test.js @@ -1115,5 +1115,121 @@ describe("ArraylistTest", function () { expect(err.message).assertEqual(`The type of "fromIndex" must be number. Received value is: a`); } }); + + /** + * @tc.name: testHas059 + * @tc.desc: Check whether the ArrayList contains a specified element. + * For example: arrayList.has.bind({})(). + */ + it('testHas059', 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.name: testRemoveByIndex060 + * @tc.desc: In the ArrayList instance, delete the element based on its index. + * For example: arrayList.removeByIndex.bind({})(). + */ + it('testRemoveByIndex060', 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.name: testRemove061 + * @tc.desc: Delete the specified element . For example: arrayList.remove.bind({})(). + */ + it('testRemove061', 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.name: testForEach062 + * @tc.desc: Traversing elements in an ArrayList instance. + * For example: arrayList.forEach.bind({}, "a")(() => {}). + */ + it('testForEach062', 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.name: testForEach063 + * @tc.desc: Traversing elements in an ArrayList instance. + * For example: arrayList.forEach(11). + */ + it('testForEach063', 0, function () { + let arrayList = new ArrayList(); + try { + arrayList.forEach(11); + expect(true).assertEqual(false); + } catch (err) { + expect(err.name).assertEqual("BusinessError"); + expect(err.code).assertEqual(401); + expect(err.message).assertEqual(`The type of "callbackfn" must be callable. Received value is: 11`); + } + }); + + /** + * @tc.name: testClear064 + * @tc.desc: Clear all elements in the ArrayList instance. For example: arrayList.clear.bind({}, "a")(). + */ + it('testClear064', 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.name: testIsEmpty065 + * @tc.desc: Determine whether the ArrayList instance is empty. For example: arrayList.isEmpty.bind({}, "a")(). + */ + it('testIsEmpty065', 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`); + } + }); }); } diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/List.test.js b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/List.test.js index 1129c445c452412373b399ca545f7321ae8e480d..470b0c64319be66159ed2296481a6976b84b8901 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/List.test.js +++ b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/List.test.js @@ -1145,5 +1145,69 @@ describe("ListTest", function () { expect(err.message).assertEqual(`The type of "fromIndex" must be number. Received value is: a`); } }); + + /** + * @tc.name: testAdd072 + * @tc.desc: Add a element to the end of the List instance. For example: list.add.bind({}, "a")(). + */ + it('testAdd072', 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.name: testForEach073 + * @tc.desc: Traversing elements in an List instance. For example: list.forEach(11). + */ + it('testForEach073', 0, function () { + let list = new List(); + try { + list.forEach(11); + expect(true).assertEqual(false); + } catch (err) { + expect(err.name).assertEqual("BusinessError"); + expect(err.code).assertEqual(401); + expect(err.message).assertEqual(`The type of "callbackfn" must be callable. Received value is: 11`); + } + }); + + /** + * @tc.name: testForEach074 + * @tc.desc: Traversing elements in an List instance. For example: list.forEach.bind({}, "a")(). + */ + it('testForEach074', 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.name: testIsEmpty075 + * @tc.desc: Determine whether the List instance is empty. For example: list.isEmpty.bind({}, "a")(). + */ + it('testIsEmpty075', 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`); + } }); +}); } diff --git a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/Stack.test.js b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/Stack.test.js index 9ca58c62a77974f07327c2a08a5d795afebfb1c8..3788d3591964876243e6b39d7d95816fef65bb99 100644 --- a/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/Stack.test.js +++ b/commonlibrary/ets_utils/containerLine_lib_standard/src/main/js/test/Stack.test.js @@ -496,5 +496,37 @@ describe("StackTest", function () { 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/ets_utils/containerRelation_lib_standard/src/main/js/test/HashMap.test.js b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashMap.test.js index b55f17be7575f62e13298cd9c7da4da7121297b8..d190838fb30e9177f37c512a8b59379361171e43 100644 --- a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashMap.test.js +++ b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashMap.test.js @@ -740,5 +740,117 @@ describe("HashMapTest", function () { expect(err.message).assertEqual(`The set method cannot be bound`); } }); + + /** + * @tc.name: testIsEmpty050 + * @tc.desc: Determine whether the HashMap instance is empty. For example: hashMap.isEmpty.bind({}, "a")(). + */ + it('testIsEmpty050', 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.name: testHasKey051 + * @tc.desc: Determine whether the HashMap contains the specified key. For example: hashMap.hasKey.bind({}, "a")(). + */ + it('testHasKey051', 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.name: testGet052 + * @tc.desc: Get the corresponding value through the key. For example: hashMap.get.bind({}, "a")(). + */ + it('testGet052', 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.name: testSet053 + * @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(undefined, 11). + */ + it('testSet053', 0, function () { + let hashMap = new HashMap(); + try { + hashMap.set(undefined, 11); + 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 Key of JS. Received value is: undefined`); + } + }); + + /** + * @tc.name: testRemove054 + * @tc.desc: Delete key value pairs according to key. For example: hashMap.remove.bind({}, "a")(). + */ + it('testRemove054', 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.name: testForEach055 + * @tc.desc: Traverse all key value pairs in the HashMap instance.For example: hashMap.forEach.bind({}, "a")(). + */ + it('testForEach055', 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.name: testForEach056 + * @tc.desc: Traverse all key value pairs in the HashMap instance.For example: hashMap.forEach(11). + */ + it('testForEach056', 0, function () { + let hashMap = new HashMap(); + try { + hashMap.forEach(11); + expect(true).assertEqual(false); + } catch (err) { + expect(err.name).assertEqual("BusinessError"); + expect(err.code).assertEqual(401); + expect(err.message).assertEqual(`The type of "callbackfn" must be callable. Received value is: 11`); + } + }); }); } diff --git a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashSet.test.js b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashSet.test.js index a85e60c47eff838646ce91a258b68d7fd7a96b69..43bd49d530e94bdd1b295097c798beb10ed1ff59 100644 --- a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashSet.test.js +++ b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/HashSet.test.js @@ -540,5 +540,55 @@ describe("HashSetTest", function () { expect(err.message).assertEqual(`The add method cannot be bound`); } }); + + /** + * @tc.name: testIsEmpty034 + * @tc.desc: Determine whether the HashSet instance is empty. For example: hashSet.isEmpty.bind({}, "a")(). + */ + it('testIsEmpty034', 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.name: testForEach035 + * @tc.desc: Traverse the collection of all elements of the HashSet instance. + * For example: hashSet.forEach.bind({}, "a")(). + */ + it('testForEach035', 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.name: testForEach036 + * @tc.desc: Traverse the collection of all elements of the HashSet instance. + * For example: hashSet.forEach(11). + */ + it('testForEach036', 0, function () { + let hashSet = new HashSet(); + try { + hashSet.forEach(11); + expect(true).assertEqual(false); + } catch (err) { + expect(err.name).assertEqual("BusinessError"); + expect(err.code).assertEqual(401); + expect(err.message).assertEqual(`The type of "callbackfn" must be callable. Received value is: 11`); + } + }); }); } diff --git a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js index 3ce7a468e92247e1796d6905886f14bb031339cf..a6ea030bf991f379c4a019b9c47922b41871b9ec 100644 --- a/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js +++ b/commonlibrary/ets_utils/containerRelation_lib_standard/src/main/js/test/TreeSet.test.js @@ -537,5 +537,139 @@ describe("TreeSetTest", function () { expect(err.message).assertEqual(`The add method cannot be bound`); } }); + + /** + * @tc.name: testClear039 + * @tc.desc: Clear all elements of the TreeSet instance. For example: treeSet.clear.bind({}, "a")(). + */ + it('testClear039', 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.name: testGetLowerValue040 + * @tc.desc: Get a value that is a little lower than the specified value sort. + * For example: treeSet.getLowerValue.bind({}, "a")(). + */ + it('testGetLowerValue040', 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.name: testGetLowerValue041 + * @tc.desc: Get a value that is a little lower than the specified value sort. + * For example: treeSet.getLowerValue(null). + */ + it('testGetLowerValue041', 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.name: testGetHigherValue042 + * @tc.desc: Get a value that is a little higher than the specified value sort. + * For example: treeSet.getHigherValue(null). + */ + it('testGetHigherValue042', 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.name: testGetHigherValue043 + * @tc.desc: Get a value that is a little higher than the specified value sort. + * For example: treeSet.getHigherValue.bind({}, "a")(). + */ + it('testGetHigherValue043', 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.name: testForEach044 + * @tc.desc: Traverse the collection of all elements of the TreeSet instance. + * For example: treeSet.forEach.bind({}, "a")(). + */ + it('testForEach044', 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.name: testForEach045 + * @tc.desc: Traverse the collection of all elements of the TreeSet instance. + * For example: treeSet.forEach(11). + */ + it('testForEach045', 0, function () { + let treeSet = new TreeSet(); + try { + treeSet.forEach(11); + expect(true).assertEqual(false); + } catch (err) { + expect(err.name).assertEqual("BusinessError"); + expect(err.code).assertEqual(401); + expect(err.message).assertEqual(`The type of "callbackfn" must be callable. Received value is: 11`); + } + }); + + /** + * @tc.name: testValues046 + * @tc.desc: Get a collection of all the values in the TreeSet. For example: treeSet.values.bind({}, "a")(). + */ + it('testValues046', 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`); + } + }); }); }