未验证 提交 10ee0009 编写于 作者: O openharmony_ci 提交者: Gitee

!5890 container exception information xts

Merge pull request !5890 from 刘甘霖/master
......@@ -20,21 +20,20 @@ describe("DequeTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an Deque instance. For example: let deque = new Deque().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let deque = new Deque();
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new deque");
expect(err.name).assertEqual("BusinessError");
expect(err.code).assertEqual(10200012);
expect(err.message).assertEqual("The Deque's constructor cannot be directly invoked");
}
});
/**
* @tc.name: testInsertFront002
* @tc.desc: Add element to deque instance header. For example: deque.insertFront("一").
* @tc.author: wangyong
*/
it("testInsertFront002", 0, function () {
let deque = new Deque();
......@@ -46,7 +45,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront003
* @tc.desc: Add element to deque instance header. For example: deque.insertFront(8).
* @tc.author: wangyong
*/
it("testInsertFront003", 0, function () {
let deque = new Deque();
......@@ -59,7 +57,6 @@ describe("DequeTest", function () {
* @tc.name: testInsertFront004
* @tc.desc: Add element to deque instance header.
* For example: let a = {name: "lala", age: "15"}; deque.insertFront(a).
* @tc.author: wangyong
*/
it("testInsertFront004", 0, function () {
let deque = new Deque();
......@@ -72,7 +69,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront005
* @tc.desc: Add element to deque instance header. For example: let a = [1, 2, 3, 4]; deque.insertFront(a).
* @tc.author: wangyong
*/
it("testInsertFront005", 0, function () {
let deque = new Deque();
......@@ -85,7 +81,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd006
* @tc.desc: Add element to deque instance end. For example: deque.insertEnd(8).
* @tc.author: wangyong
*/
it("testInsertEnd006", 0, function () {
let deque = new Deque();
......@@ -97,7 +92,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd007
* @tc.desc: Add element to deque instance end. For example: let a = ["a", "b", "c"];deque.insertEnd(a).
* @tc.author: wangyong
*/
it("testInsertEnd007", 0, function () {
let deque = new Deque();
......@@ -110,7 +104,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd008
* @tc.desc: Add element to deque instance end. For example: let a = {class: "6班", say: "we"};deque.insertEnd(a).
* @tc.author: wangyong
*/
it("testInsertEnd008", 0, function () {
let deque = new Deque();
......@@ -123,7 +116,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testGetFirst009
* @tc.desc: Get the header element of the deque instance. For example: deque.getFirst().
* @tc.author: wangyong
*/
it("testGetFirst009", 0, function () {
let deque = new Deque();
......@@ -136,7 +128,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testGetLast010
* @tc.desc: Get the end element of the deque instance. For example: deque.getLast().
* @tc.author: wangyong
*/
it("testGetLast010", 0, function () {
let deque = new Deque();
......@@ -149,7 +140,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testHas011
* @tc.desc: Determine whether the deque instance contains the specified element. For example: deque.has(6).
* @tc.author: wangyong
*/
it("testHas011", 0, function () {
let deque = new Deque();
......@@ -161,7 +151,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testHas012
* @tc.desc: Determine whether the deque instance contains the specified element. For example: deque.has(6).
* @tc.author: wangyong
*/
it("testHas012", 0, function () {
let deque = new Deque();
......@@ -173,7 +162,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testPopFirst013
* @tc.desc: Delete the header element of a deque instance. For example: deque.popFirst().
* @tc.author: wangyong
*/
it("testPopFirst013", 0, function () {
let deque = new Deque();
......@@ -186,7 +174,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testPopLast014
* @tc.desc: Delete the end element of a deque instance. For example: deque.popLast().
* @tc.author: wangyong
*/
it("testPopLast014", 0, function () {
let deque = new Deque();
......@@ -200,7 +187,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testForEach015
* @tc.desc: Traversing elements in deque instances. For example: deque.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach015", 0, function () {
let deque = new Deque();
......@@ -228,7 +214,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testIterator016
* @tc.desc: Iterate over all elements in the deque instance. For example: for (let item of deque) { arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator016", 0, function () {
let deque = new Deque();
......@@ -252,7 +237,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront017
* @tc.desc: Add element to deque instance header. For example: deque.insertFront("$").
* @tc.author: wangyong
*/
it("testInsertFront017", 0, function () {
let deque = new Deque();
......@@ -264,7 +248,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront018
* @tc.desc: Add element to deque instance header. For example: deque.insertFront(" ").
* @tc.author: wangyong
*/
it("testInsertFront018", 0, function () {
let deque = new Deque();
......@@ -276,7 +259,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront019
* @tc.desc: Add element to deque instance header. For example: deque.insertFront(null).
* @tc.author: wangyong
*/
it("testInsertFront019", 0, function () {
let deque = new Deque();
......@@ -288,7 +270,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront020
* @tc.desc: Add element to deque instance header. For example: deque.insertFront(undefined).
* @tc.author: wangyong
*/
it("testInsertFront020", 0, function () {
let deque = new Deque();
......@@ -300,7 +281,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront021
* @tc.desc: Add element to deque instance header. For example: for (let i = 0; i < 100; i++) {deque.insertFront(i)}.
* @tc.author: wangyong
*/
it("testInsertFront021", 0, function () {
let deque = new Deque();
......@@ -316,7 +296,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd022
* @tc.desc: Add element to deque instance end. For example: deque.insertEnd("$").
* @tc.author: wangyong
*/
it("testInsertEnd022", 0, function () {
let deque = new Deque();
......@@ -328,7 +307,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd023
* @tc.desc: Add element to deque instance end. For example: deque.insertEnd(" ").
* @tc.author: wangyong
*/
it("testInsertEnd023", 0, function () {
let deque = new Deque();
......@@ -340,7 +318,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd024
* @tc.desc: Add element to deque instance end. For example: deque.insertEnd(null).
* @tc.author: wangyong
*/
it("testInsertEnd024", 0, function () {
let deque = new Deque();
......@@ -352,7 +329,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertEnd025
* @tc.desc: Add element to deque instance end. For example: deque.insertEnd(undefined).
* @tc.author: wangyong
*/
it("testInsertEnd025", 0, function () {
let deque = new Deque();
......@@ -364,7 +340,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testInsertFront026
* @tc.desc: Add element to deque instance end. For example: for (let i = 0; i < 100; i++) {deque.insertEnd(i);}.
* @tc.author: wangyong
*/
it("testInsertFront026", 0, function () {
let deque = new Deque();
......@@ -380,7 +355,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testHas027
* @tc.desc: Determine whether the deque instance contains the specified element. For example: deque.has(6).
* @tc.author: wangyong
*/
it("testHas027", 0, function () {
let deque = new Deque();
......@@ -391,7 +365,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testPopFirst028
* @tc.desc: Delete the header element of a deque instance. For example: deque.popFirst().
* @tc.author: wangyong
*/
it("testPopFirst028", 0, function () {
let deque = new Deque();
......@@ -402,7 +375,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testGetFirst029
* @tc.desc: Get the header element of the deque instance. For example: deque.getFirst().
* @tc.author: wangyong
*/
it("testGetFirst029", 0, function () {
let deque = new Deque();
......@@ -413,7 +385,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testPopLast030
* @tc.desc: Delete the end element of a deque instance. For example: deque.popLast().
* @tc.author: wangyong
*/
it("testPopLast030", 0, function () {
let deque = new Deque();
......@@ -424,7 +395,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testGetLast031
* @tc.desc: Get the end element of the deque instance. For example: deque.getLast().
* @tc.author: wangyong
*/
it("testGetLast031", 0, function () {
let deque = new Deque();
......@@ -435,7 +405,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testForEach032
* @tc.desc: Traversing elements in deque instances. For example: deque.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach032", 0, function () {
let deque = new Deque();
......@@ -464,7 +433,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testIterator033
* @tc.desc: Iterate over all elements in the deque instance. For example: for (let item of deque) { arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator033", 0, function () {
let deque = new Deque();
......@@ -492,7 +460,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testIterator034
* @tc.desc: Iterate over all elements in the deque instance. For example: deque[Symbol.iterator]().
* @tc.author: wangyong
*/
it("testIterator034", 0, function () {
let deque = new Deque();
......@@ -522,7 +489,6 @@ describe("DequeTest", function () {
/**
* @tc.name: testLength035
* @tc.desc: Get the number of elements in the deque instance. For example: deque.length.
* @tc.author: wangyong
*/
it("testLength035", 0, function () {
let deque = new Deque();
......@@ -540,5 +506,37 @@ describe("DequeTest", function () {
let size = deque.length;
expect(size).assertEqual(7);
});
/**
* @tc.name: testInsertFront036
* @tc.desc: Add element to deque instance header.For example: let a = [1, 2, 3, 4]; deque.insertFront.bind({}, "a")().
*/
it("testInsertFront036 ", 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.name: testForEach037
* @tc.desc: Traversing elements in deque instances. For example: deque.forEach(123).
*/
it("testForEach037", 0, function () {
let deque = new Deque();
try {
deque.forEach(123);
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: 123`);
}
});
});
}
......@@ -20,21 +20,20 @@ describe("QueueTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an Queue instance. For example: let queue = new Queue().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let queue = new Queue();
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new queue");
expect(err.name).assertEqual("BusinessError");
expect(err.code).assertEqual(10200012);
expect(err.message).assertEqual("The Queue's constructor cannot be directly invoked");
}
});
/**
* @tc.name: testAdd002
* @tc.desc: Add element to Queue instance end. For example: queue.add("四").
* @tc.author: wangyong
*/
it("testAdd002", 0, function () {
let queue = new Queue();
......@@ -46,7 +45,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd003
* @tc.desc: Add element to Queue instance end. For example: queue.add(8).
* @tc.author: wangyong
*/
it("testAdd003", 0, function () {
let queue = new Queue();
......@@ -58,7 +56,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd004
* @tc.desc: Add element to Queue instance end. For example: queue.add(8).
* @tc.author: wangyong
*/
it("testAdd004", 0, function () {
let queue = new Queue();
......@@ -71,7 +68,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testGetFirst005
* @tc.desc: Get the header element of the queue instance. For example: queue.getFirst().
* @tc.author: wangyong
*/
it("testGetFirst005", 0, function () {
let queue = new Queue();
......@@ -84,7 +80,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testPop006
* @tc.desc: Delete the header element of a queue instance. For example: queue.pop().
* @tc.author: wangyong
*/
it("testPop006", 0, function () {
let queue = new Queue();
......@@ -99,7 +94,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testForEach007
* @tc.desc: Traversing elements in queue instances. For example: queue.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach007", 0, function () {
let queue = new Queue();
......@@ -127,7 +121,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testIterator008
* @tc.desc: Iterate over all elements in the queue instance. For example: for (let item of queue) { arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator008", 0, function () {
let queue = new Queue();
......@@ -151,7 +144,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testLength009
* @tc.desc: Get the number of elements in the queue instance. For example: queue.length.
* @tc.author: wangyong
*/
it("testLength009", 0, function () {
let queue = new Queue();
......@@ -171,7 +163,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd010
* @tc.desc: Add element to Queue instance end. For example: queue.add("$").
* @tc.author: wangyong
*/
it("testAdd010", 0, function () {
let queue = new Queue();
......@@ -183,7 +174,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd011
* @tc.desc: Add element to Queue instance end. For example: queue.add(" ").
* @tc.author: wangyong
*/
it("testAdd011", 0, function () {
let queue = new Queue();
......@@ -195,7 +185,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd012
* @tc.desc: Add element to Queue instance end. For example: queue.add(null).
* @tc.author: wangyong
*/
it("testAdd012", 0, function () {
let queue = new Queue();
......@@ -207,7 +196,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd013
* @tc.desc: Add element to Queue instance end. For example: queue.add(undefined).
* @tc.author: wangyong
*/
it("testAdd013", 0, function () {
let queue = new Queue();
......@@ -219,7 +207,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testAdd014
* @tc.desc: Add element to Queue instance end. For example: for (let i = 0; i < 100; i++) { queue.add(i);}.
* @tc.author: wangyong
*/
it("testAdd014", 0, function () {
let queue = new Queue();
......@@ -233,7 +220,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testGetFirst015
* @tc.desc: Get the header element of the queue instance. For example: queue.getFirst().
* @tc.author: wangyong
*/
it("testGetFirst015", 0, function () {
let queue = new Queue();
......@@ -244,7 +230,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testPop016
* @tc.desc: Delete the header element of a queue instance. For example: queue.pop().
* @tc.author: wangyong
*/
it("testPop016", 0, function () {
let queue = new Queue();
......@@ -255,7 +240,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testForEach017
* @tc.desc: Traversing elements in queue instances. For example: queue.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach017", 0, function () {
let queue = new Queue();
......@@ -269,7 +253,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testIterator018
* @tc.desc: Iterate over all elements in the queue instance. For example: for (let item of queue) { arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator018", 0, function () {
let queue = new Queue();
......@@ -283,7 +266,6 @@ describe("QueueTest", function () {
/**
* @tc.name: testIterator019
* @tc.desc: Iterate over all elements in the queue instance. For example: queue[Symbol.iterator]().
* @tc.author: wangyong
*/
it("testIterator019", 0, function () {
let queue = new Queue();
......@@ -305,5 +287,21 @@ describe("QueueTest", function () {
expect(arr[i]).assertEqual(a[i]);
}
});
/**
* @tc.name: testAdd020
* @tc.desc: Add element to Queue instance end. For example: queue.add.bind({}, 10)().
*/
it("testAdd020 ", 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`);
}
});
});
}
......@@ -20,22 +20,21 @@ describe("StackTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an Stack instance. For example: let stack = new Stack().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let stack = new Stack();
expect(stack != undefined).assertEqual(true);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new stack");
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("四").
* @tc.author: wangyong
*/
it("testPush002", 0, function () {
let stack = new Stack();
......@@ -47,7 +46,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush003
* @tc.desc: Insert element at top of stack.For example: stack.push(8).
* @tc.author: wangyong
*/
it("testPush003", 0, function () {
let stack = new Stack();
......@@ -59,7 +57,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush004
* @tc.desc: Insert element at top of stack.For example: let a = {name: "lala", age: "13岁"}; stack.push(a).
* @tc.author: wangyong
*/
it("testPush004", 0, function () {
let stack = new Stack();
......@@ -72,7 +69,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush005
* @tc.desc: Insert element at top of stack.For example: let a = [1, 2, 3, 4]; stack.push(a).
* @tc.author: wangyong
*/
it("testPush005", 0, function () {
let stack = new Stack();
......@@ -85,7 +81,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPeek006
* @tc.desc: Get stack top element. For example: stack.peek().
* @tc.author: wangyong
*/
it("testPeek006", 0, function () {
let stack = new Stack();
......@@ -101,7 +96,6 @@ describe("StackTest", function () {
/**
* @tc.name: testLocate007
* @tc.desc: Get the index corresponding to the element in the stack. For example: stack.locate("A").
* @tc.author: wangyong
*/
it("testLocate007", 0, function () {
let stack = new Stack();
......@@ -120,7 +114,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPop008
* @tc.desc: Delete top of stack element. For example: stack.pop().
* @tc.author: wangyong
*/
it("testPop008", 0, function () {
let stack = new Stack();
......@@ -135,7 +128,6 @@ describe("StackTest", function () {
/**
* @tc.name: testForEach009
* @tc.desc: Traversing elements in stack instances. For example: stack.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach009", 0, function () {
let stack = new Stack();
......@@ -159,7 +151,6 @@ describe("StackTest", function () {
/**
* @tc.name: testIterator010
* @tc.desc: Iterate over all elements in the stack instance. For example: for (let item of stack) {arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator010", 0, function () {
let stack = new Stack();
......@@ -185,7 +176,6 @@ describe("StackTest", function () {
/**
* @tc.name: testLength011
* @tc.desc: Get the number of elements in the stack instance. For example: stack.length.
* @tc.author: wangyong
*/
it("testLength011", 0, function () {
let stack = new Stack();
......@@ -200,7 +190,6 @@ describe("StackTest", function () {
/**
* @tc.name: testLength012
* @tc.desc: Get the number of elements in the stack instance. For example: stack.length.
* @tc.author: wangyong
*/
it("testLength012", 0, function () {
let stack = new Stack();
......@@ -211,7 +200,6 @@ describe("StackTest", function () {
/**
* @tc.name: testIsEmpty013
* @tc.desc: Determine whether the Stack instance is empty. For example: stack.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty013", 0, function () {
let stack = new Stack();
......@@ -226,7 +214,6 @@ describe("StackTest", function () {
/**
* @tc.name: testIsEmpty014
* @tc.desc: Determine whether the Stack instance is empty. For example: stack.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty014", 0, function () {
let stack = new Stack();
......@@ -237,7 +224,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush015
* @tc.desc: Insert element at top of stack.For example: stack.push("你好世界").
* @tc.author: wangyong
*/
it("testPush015", 0, function () {
let stack = new Stack();
......@@ -249,7 +235,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush016
* @tc.desc: Insert element at top of stack.For example: stack.push(1234).
* @tc.author: wangyong
*/
it("testPush016", 0, function () {
let stack = new Stack();
......@@ -261,7 +246,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush017
* @tc.desc: Insert element at top of stack.For example: stack.push(1.234).
* @tc.author: wangyong
*/
it("testPush017", 0, function () {
let stack = new Stack();
......@@ -273,7 +257,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush018
* @tc.desc: Insert element at top of stack.For example: stack.push(-1234).
* @tc.author: wangyong
*/
it("testPush018", 0, function () {
let stack = new Stack();
......@@ -285,7 +268,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush019
* @tc.desc: Insert element at top of stack.For example: stack.push(0).
* @tc.author: wangyong
*/
it("testPush019", 0, function () {
let stack = new Stack();
......@@ -297,7 +279,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush020
* @tc.desc: Insert element at top of stack.For example: stack.push("*").
* @tc.author: wangyong
*/
it("testPush020", 0, function () {
let stack = new Stack();
......@@ -313,7 +294,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush021
* @tc.desc: Insert element at top of stack.For example: let arr = {}; stack.push(arr).
* @tc.author: wangyong
*/
it("testPush021", 0, function () {
let stack = new Stack();
......@@ -326,7 +306,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush022
* @tc.desc: Insert element at top of stack.For example: let arr = []; stack.push(arr).
* @tc.author: wangyong
*/
it("testPush022", 0, function () {
let stack = new Stack();
......@@ -339,7 +318,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush023
* @tc.desc: Insert element at top of stack.For example: stack.push("hello world").
* @tc.author: wangyong
*/
it("testPush023", 0, function () {
let stack = new Stack();
......@@ -351,7 +329,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush024
* @tc.desc: Insert element at top of stack.
* @tc.author: wangyong
*/
it("testPush024", 0, function () {
let stack = new Stack();
......@@ -363,7 +340,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush025
* @tc.desc: Insert element at top of stack. For example: stack.push("").
* @tc.author: wangyong
*/
it("testPush025", 0, function () {
let stack = new Stack();
......@@ -375,7 +351,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush026
* @tc.desc: Insert element at top of stack. For example: stack.push(true).
* @tc.author: wangyong
*/
it("testPush026", 0, function () {
let stack = new Stack();
......@@ -387,7 +362,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush027
* @tc.desc: Insert element at top of stack. For example: stack.push(false).
* @tc.author: wangyong
*/
it("testPush027", 0, function () {
let stack = new Stack();
......@@ -399,7 +373,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush028
* @tc.desc: Insert element at top of stack. For example: stack.push(null).
* @tc.author: wangyong
*/
it("testPush028", 0, function () {
let stack = new Stack();
......@@ -411,7 +384,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush029
* @tc.desc: Insert element at top of stack. For example: stack.push(undefined).
* @tc.author: wangyong
*/
it("testPush029", 0, function () {
let stack = new Stack();
......@@ -423,7 +395,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPeek030
* @tc.desc: Get stack top element. For example: stack.peek().
* @tc.author: wangyong
*/
it("testPeek030", 0, function () {
let stack = new Stack();
......@@ -434,7 +405,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPop031
* @tc.desc: Delete top of stack element. For example: stack.pop().
* @tc.author: wangyong
*/
it("testPop031", 0, function () {
let stack = new Stack();
......@@ -445,7 +415,6 @@ describe("StackTest", function () {
/**
* @tc.name: testForEach032
* @tc.desc: Traversing elements in stack instances. For example: stack.forEach((item, index) => {arr.push(item);}).
* @tc.author: wangyong
*/
it("testForEach032", 0, function () {
let stack = new Stack();
......@@ -459,7 +428,6 @@ describe("StackTest", function () {
/**
* @tc.name: testIterator033
* @tc.desc: Iterate over all elements in the stack instance. For example: for (let item of stack) {arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator033", 0, function () {
let stack = new Stack();
......@@ -473,7 +441,6 @@ describe("StackTest", function () {
/**
* @tc.name: testPush034
* @tc.desc: Insert element at top of stack. For example: for (let i = 0; i < 1000; i++) {stack.push(i);}.
* @tc.author: wangyong
*/
it("testPush034", 0, function () {
let stack = new Stack();
......@@ -489,7 +456,6 @@ describe("StackTest", function () {
/**
* @tc.name: testIterator035
* @tc.desc: Iterate over all elements in the stack instance. For example: stack[Symbol.iterator]().
* @tc.author: wangyong
*/
it("testIterator035", 0, function () {
let stack = new Stack();
......@@ -514,5 +480,21 @@ describe("StackTest", function () {
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`);
}
});
});
}
......@@ -20,22 +20,21 @@ describe("HashMapTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an HashMap instance. For example: let hashMap = new HashMap().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let hashMap = new HashMap();
expect(hashMap != undefined).assertEqual(true);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new HashMap");
expect(err.name).assertEqual("BusinessError");
expect(err.code).assertEqual(10200012);
expect(err.message).assertEqual("The HashMap's constructor cannot be directly invoked");
}
});
/**
* @tc.name: testSet002
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, "A").
* @tc.author: wangyong
*/
it("testSet002", 0, function () {
let hashMap = new HashMap();
......@@ -47,7 +46,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet003
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, 2).
* @tc.author: wangyong
*/
it("testSet003", 0, function () {
let hashMap = new HashMap();
......@@ -59,7 +57,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet004
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: let c = [1, 2, 3]; hashMap.set(1, c).
* @tc.author: wangyong
*/
it("testSet004", 0, function () {
let hashMap = new HashMap();
......@@ -73,7 +70,6 @@ describe("HashMapTest", function () {
* @tc.name: testSet005
* @tc.desc: Add a pair of key value pairs to the HashMap.
* For example: let c = {name: "lili", age: "13"}; hashMap.set(1, c).
* @tc.author: wangyong
*/
it("testSet005", 0, function () {
let hashMap = new HashMap();
......@@ -86,7 +82,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet006
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set("a", "A").
* @tc.author: wangyong
*/
it("testSet006", 0, function () {
let hashMap = new HashMap();
......@@ -98,7 +93,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet007
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set("", "A").
* @tc.author: wangyong
*/
it("testSet007", 0, function () {
let hashMap = new HashMap();
......@@ -110,7 +104,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet008
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set("$", "A").
* @tc.author: wangyong
*/
it("testSet008", 0, function () {
let hashMap = new HashMap();
......@@ -122,7 +115,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet009
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(3.14, "A").
* @tc.author: wangyong
*/
it("testSet009", 0, function () {
let hashMap = new HashMap();
......@@ -134,7 +126,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet010
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(0.3, "A").
* @tc.author: wangyong
*/
it("testSet010", 0, function () {
let hashMap = new HashMap();
......@@ -146,7 +137,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet011
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(-1, "A").
* @tc.author: wangyong
*/
it("testSet011", 0, function () {
let hashMap = new HashMap();
......@@ -158,7 +148,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet012
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: let a = {}; hashMap.set(a, "A").
* @tc.author: wangyong
*/
it("testSet012", 0, function () {
let hashMap = new HashMap();
......@@ -171,7 +160,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet013
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, null).
* @tc.author: wangyong
*/
it("testSet013", 0, function () {
let hashMap = new HashMap();
......@@ -183,7 +171,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet014
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, "$").
* @tc.author: wangyong
*/
it("testSet014", 0, function () {
let hashMap = new HashMap();
......@@ -195,7 +182,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet015
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, "3.14").
* @tc.author: wangyong
*/
it("testSet015", 0, function () {
let hashMap = new HashMap();
......@@ -207,7 +193,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet016
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set(1, -1).
* @tc.author: wangyong
*/
it("testSet016", 0, function () {
let hashMap = new HashMap();
......@@ -219,7 +204,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet017
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: let a = {}; hashMap.set(1, a).
* @tc.author: wangyong
*/
it("testSet017", 0, function () {
let hashMap = new HashMap();
......@@ -233,7 +217,6 @@ describe("HashMapTest", function () {
* @tc.name: testSet018
* @tc.desc: Add a pair of key value pairs to the HashMap.
* For example: for (let i = 0; i < 100; i++) {hashMap.set(1, i);}.
* @tc.author: wangyong
*/
it("testSet018", 0, function () {
let hashMap = new HashMap();
......@@ -249,7 +232,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSet019
* @tc.desc: Add a pair of key value pairs to the HashMap.
* @tc.author: wangyong
*/
it("testSet019", 0, function () {
let hashMap = new HashMap();
......@@ -265,7 +247,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testLength020
* @tc.desc: Get the number of key value pairs in the HashMap instance. For example: hashMap.length.
* @tc.author: wangyong
*/
it("testLength020", 0, function () {
let hashMap = new HashMap();
......@@ -281,7 +262,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testHasKey021
* @tc.desc: Determine whether the HashMap contains the specified key. For example: hashMap.hasKey(3).
* @tc.author: wangyong
*/
it("testHasKey021", 0, function () {
let hashMap = new HashMap();
......@@ -299,7 +279,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testHasKey022
* @tc.desc: Determine whether the HashMap contains the specified key. For example: hashMap.hasKey(8).
* @tc.author: wangyong
*/
it("testHasKey022", 0, function () {
let hashMap = new HashMap();
......@@ -310,7 +289,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testHasValue023
* @tc.desc: Determine whether the HashMap contains the specified value. For example: hashMap.hasValue("C").
* @tc.author: wangyong
*/
it("testHasValue023", 0, function () {
let hashMap = new HashMap();
......@@ -328,7 +306,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testHasValue024
* @tc.desc: Determine whether the HashMap contains the specified value. For example: hashMap.hasValue(8).
* @tc.author: wangyong
*/
it("testHasValue024", 0, function () {
let hashMap = new HashMap();
......@@ -339,7 +316,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testGet025
* @tc.desc: Get the corresponding value through the key. For example: hashMap.get(3).
* @tc.author: wangyong
*/
it("testGet025", 0, function () {
let hashMap = new HashMap();
......@@ -355,7 +331,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testGet026
* @tc.desc: Get the corresponding value through the key. For example: hashMap.get(3).
* @tc.author: wangyong
*/
it("testGet026", 0, function () {
let hashMap = new HashMap();
......@@ -366,7 +341,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSetAll027
* @tc.desc: Copy key value pairs from one HashMap to another.
* @tc.author: wangyong
*/
it("testSetAll027", 0, function () {
let hashMap = new HashMap();
......@@ -396,7 +370,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testSetAll028
* @tc.desc: Copy key value pairs from one HashMap to another.
* @tc.author: wangyong
*/
it("testSetAll028", 0, function () {
let hashMap = new HashMap();
......@@ -421,7 +394,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testRemove029
* @tc.desc: Delete key value pairs according to key. For example: hashMap.remove(3).
* @tc.author: wangyong
*/
it("testRemove029", 0, function () {
let hashMap = new HashMap();
......@@ -439,7 +411,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testRemove030
* @tc.desc: Delete key value pairs according to key. For example: hashMap.remove(3).
* @tc.author: wangyong
*/
it("testRemove030", 0, function () {
let hashMap = new HashMap();
......@@ -450,7 +421,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testClear031
* @tc.desc: Clear all key value pairs in HashMap. For example: hashMap.clear().
* @tc.author: wangyong
*/
it("testClear031", 0, function () {
let hashMap = new HashMap();
......@@ -469,7 +439,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testClear032
* @tc.desc: Clear all key value pairs in HashMap. For example: hashMap.clear().
* @tc.author: wangyong
*/
it("testClear032", 0, function () {
let hashMap = new HashMap();
......@@ -481,7 +450,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testKeys033
* @tc.desc: Get a collection of all the keys in the HashMap. For example: hashMap.keys().
* @tc.author: wangyong
*/
it("testKeys033", 0, function () {
let hashMap = new HashMap();
......@@ -499,7 +467,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testValues034
* @tc.desc: Get a collection of all the values in the HashMap. For example: hashMap.values().
* @tc.author: wangyong
*/
it("testValues034", 0, function () {
let hashMap = new HashMap();
......@@ -518,7 +485,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testReplace035
* @tc.desc: Modify the corresponding value according to the specified key. For example: hashMap.replace(2, "G").
* @tc.author: wangyong
*/
it("testReplace035", 0, function () {
let hashMap = new HashMap();
......@@ -535,7 +501,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testReplace036
* @tc.desc: Modify the corresponding value according to the specified key. For example: hashMap.replace(2, "G").
* @tc.author: wangyong
*/
it("testReplace036", 0, function () {
let hashMap = new HashMap();
......@@ -546,7 +511,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testForEach037
* @tc.desc: Traverse all key value pairs in the HashMap instance.
* @tc.author: wangyong
*/
it("testForEach037", 0, function () {
let hashMap = new HashMap();
......@@ -574,7 +538,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testForEach038
* @tc.desc: Traverse all key value pairs in the HashMap instance.
* @tc.author: wangyong
*/
it("testForEach038", 0, function () {
let hashMap = new HashMap();
......@@ -588,7 +551,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testIterator039
* @tc.desc: Iterate over all key value pairs in the HashMap.
* @tc.author: wangyong
*/
it("testIterator039", 0, function () {
let hashMap = new HashMap();
......@@ -613,7 +575,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testIterator040
* @tc.desc: Traverse all key value pairs in the HashMap instance.
* @tc.author: wangyong
*/
it("testIterator040", 0, function () {
let hashMap = new HashMap();
......@@ -627,7 +588,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testEntries041
* @tc.desc: Get all key value pairs collection in HashMap.
* @tc.author: wangyong
*/
it("testEntries041", 0, function () {
let hashMap = new HashMap();
......@@ -654,7 +614,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testEntries042
* @tc.desc: Get all key value pairs collection in HashMap.
* @tc.author: wangyong
*/
it("testEntries042", 0, function () {
let hashMap = new HashMap();
......@@ -665,7 +624,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testIsEmpty043
* @tc.desc: Determine whether the HashMap instance is empty. For example: hashMap.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty043", 0, function () {
let hashMap = new HashMap();
......@@ -683,7 +641,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testIsEmpty044
* @tc.desc: Determine whether the HashMap instance is empty. For example: hashMap.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty044", 0, function () {
let hashMap = new HashMap();
......@@ -702,7 +659,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testEntries045
* @tc.desc: Get all key value pairs collection in HashMap.For example: hashMap.entries().
* @tc.author: wangyong
*/
it("testEntries045", 0, function () {
let hashMap = new HashMap();
......@@ -713,7 +669,6 @@ describe("HashMapTest", function () {
/**
* @tc.name: testIterator046
* @tc.desc: Iterate over all key value pairs in the HashMap. For example: hashMap[Symbol.iterator]().
* @tc.author: wangyong
*/
it("testIterator046", 0, function () {
let hashMap = new HashMap();
......@@ -735,5 +690,55 @@ describe("HashMapTest", function () {
}
expect(flag).assertEqual(true);
});
/**
* @tc.name: testSet047
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set.bind({}, 1, "A")().
*/
it("testSet047", 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.name: testSetAll048
* @tc.desc: Copy key value pairs from one HashMap to another.
*/
it("testSetAll048", 0, function () {
let hashMap = new HashMap();
hashMap.set(1, "A");
hashMap.set(2, "B");
try {
hashMap.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 HashMap. Received value is: 1,2,3`);
}
});
/**
* @tc.name: testSet049
* @tc.desc: Add a pair of key value pairs to the HashMap. For example: hashMap.set.bind({}, "a", "b")().
*/
it("testSet049", 0, function () {
let hashMap = new HashMap();
try {
hashMap.set.bind({}, "a", "b")();
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`);
}
});
});
}
......@@ -20,21 +20,20 @@ describe("HashSetTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an HashSet instance. For example: let hashSet = new HashSet().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let hashSet = new HashSet();
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new HashSet");
expect(err.name).assertEqual("BusinessError");
expect(err.code).assertEqual(10200012);
expect(err.message).assertEqual("The HashSet's constructor cannot be directly invoked");
}
});
/**
* @tc.name: testAdd001
* @tc.desc: Add element to HashSet instance. For example: hashSet.add(1).
* @tc.author: wangyong
*/
it("testAdd001", 0, function () {
let hashSet = new HashSet();
......@@ -46,7 +45,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd002
* @tc.desc: Add element to HashSet instance. For example: hashSet.add("a").
* @tc.author: wangyong
*/
it("testAdd002", 0, function () {
let hashSet = new HashSet();
......@@ -62,7 +60,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd003
* @tc.desc: Add element to HashSet instance. For example: let c = [1, 2, 3]; hashSet.add(c).
* @tc.author: wangyong
*/
it("testAdd003", 0, function () {
let hashSet = new HashSet();
......@@ -75,7 +72,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd004
* @tc.desc: Add element to HashSet instance. For example: let c = {name: "lili", age: "13"}; hashSet.add(c).
* @tc.author: wangyong
*/
it("testAdd004", 0, function () {
let hashSet = new HashSet();
......@@ -88,7 +84,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testLength005
* @tc.desc: Get the number of element in the HashSet instance. For example: hashSet.length.
* @tc.author: wangyong
*/
it("testLength005", 0, function () {
let hashSet = new HashSet();
......@@ -104,7 +99,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testHas006
* @tc.desc: Determine whether the HashSet instance contains the specified element. For example: hashSet.has(1).
* @tc.author: wangyong
*/
it("testHas006", 0, function () {
let hashSet = new HashSet();
......@@ -122,7 +116,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testIsEmpty007
* @tc.desc: Determine whether the HashSet instance is empty. For example: hashSet.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty007", 0, function () {
let hashSet = new HashSet();
......@@ -138,7 +131,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testRemove008
* @tc.desc: Delete the specified element. For example: hashSet.remove(1).
* @tc.author: wangyong
*/
it("testRemove008", 0, function () {
let hashSet = new HashSet();
......@@ -162,7 +154,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testClear009
* @tc.desc: Clear all elements of the HashSet instance. For example: hashSet.clear().
* @tc.author: wangyong
*/
it("testClear009", 0, function () {
let hashSet = new HashSet();
......@@ -181,7 +172,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testValues010
* @tc.desc: Get a collection of all elements of a HashSet instance. For example: hashSet.values().
* @tc.author: wangyong
*/
it("testValues010", 0, function () {
let hashSet = new HashSet();
......@@ -200,7 +190,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testForEach011
* @tc.desc: Traverse the collection of all elements of the HashSet instance.
* @tc.author: wangyong
*/
it("testForEach011", 0, function () {
let hashSet = new HashSet();
......@@ -223,7 +212,6 @@ describe("HashSetTest", function () {
* @tc.name: testIterator012
* @tc.desc: Iterate over all elements of the HashSet instance.
* For example: for (let item of hashSet) {arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator012", 0, function () {
let hashSet = new HashSet();
......@@ -246,7 +234,6 @@ describe("HashSetTest", function () {
* @tc.name: testIterator013
* @tc.desc: Iterate over all elements of the HashSet instance.
* For example: for (let item of hashSet) {arr.push(item);}.
* @tc.author: wangyong
*/
it("testIterator013", 0, function () {
let hashSet = new HashSet();
......@@ -268,7 +255,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testEntries014
* @tc.desc: Iterate over all elements of the HashSet instance. For example: hashSet.entries().
* @tc.author: wangyong
*/
it("testEntries014", 0, function () {
let hashSet = new HashSet();
......@@ -287,7 +273,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd015
* @tc.desc: Add element to HashSet instance. For example: hashSet.add("").
* @tc.author: wangyong
*/
it("testAdd015", 0, function () {
let hashSet = new HashSet();
......@@ -299,7 +284,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd016
* @tc.desc: Add element to HashSet instance. For example: hashSet.add("$").
* @tc.author: wangyong
*/
it("testAdd016", 0, function () {
let hashSet = new HashSet();
......@@ -311,7 +295,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd017
* @tc.desc: Add element to HashSet instance. For example: hashSet.add(1.34).
* @tc.author: wangyong
*/
it("testAdd017", 0, function () {
let hashSet = new HashSet();
......@@ -323,7 +306,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd018
* @tc.desc: Add element to HashSet instance. For example: hashSet.add(-1).
* @tc.author: wangyong
*/
it("testAdd018", 0, function () {
let hashSet = new HashSet();
......@@ -335,7 +317,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd019
* @tc.desc: Add element to HashSet instance. For example: let a = {}; hashSet.add(a).
* @tc.author: wangyong
*/
it("testAdd019", 0, function () {
let hashSet = new HashSet();
......@@ -348,7 +329,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd020
* @tc.desc: Add element to HashSet instance.
* @tc.author: wangyong
*/
it("testAdd020", 0, function () {
let hashSet = new HashSet();
......@@ -364,7 +344,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testIterator021
* @tc.desc: Iterate over all elements of the HashSet instance.
* @tc.author: wangyong
*/
it("testIterator021", 0, function () {
let hashSet = new HashSet();
......@@ -378,7 +357,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testForEach022
* @tc.desc: Traverse the collection of all elements of the HashSet instance.
* @tc.author: wangyong
*/
it("testForEach022", 0, function () {
let hashSet = new HashSet();
......@@ -392,7 +370,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testIsEmpty023
* @tc.desc: Determine whether the HashSet instance is empty. For example: hashSet.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty023", 0, function () {
let hashSet = new HashSet();
......@@ -409,7 +386,6 @@ describe("HashSetTest", function () {
/**
* @tc.name:testHas024
* @tc.desc: Determine whether the HashSet instance contains the specified element. For example: hashSet.has(1).
* @tc.author: wangyong
*/
it("testHas024", 0, function () {
let hashSet = new HashSet();
......@@ -420,7 +396,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Delete the specified element. For example: hashSet.remove(1).
* @tc.author: wangyong
*/
it("testRemove025", 0, function () {
let hashSet = new HashSet();
......@@ -431,7 +406,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testClear026
* @tc.desc: Clear all elements of the HashSet instance. For example: hashSet.clear().
* @tc.author: wangyong
*/
it("testClear026", 0, function () {
let hashSet = new HashSet();
......@@ -442,7 +416,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testEntries027
* @tc.desc: Iterate over all elements of the HashSet instance. For example: hashSet.entries().
* @tc.author: wangyong
*/
it("testEntries027", 0, function () {
let hashSet = new HashSet();
......@@ -453,7 +426,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testIterator028
* @tc.desc: Iterate over all elements of the HashSet instance.
* @tc.author: wangyong
*/
it("testIterator028", 0, function () {
let hashSet = new HashSet();
......@@ -474,7 +446,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testForEach029
* @tc.desc: Traverse the collection of all elements of the HashSet instance.
* @tc.author: wangyong
*/
it("testForEach029", 0, function () {
let hashSet = new HashSet();
......@@ -495,7 +466,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testAdd030
* @tc.desc: Add element to HashSet instance. For example: hashSet.add(1).
* @tc.author: wangyong
*/
it("testAdd030", 0, function () {
let hashSet = new HashSet();
......@@ -510,7 +480,6 @@ describe("HashSetTest", function () {
/**
* @tc.name: testIterator031
* @tc.desc: Iterate over all elements of the HashSet instance. For example: hashSet[Symbol.iterator]().
* @tc.author: wangyong
*/
it("testIterator031", 0, function () {
let hashSet = new HashSet();
......@@ -534,5 +503,42 @@ describe("HashSetTest", function () {
expect(arr[i]).assertEqual(arr1[i]);
}
});
/**
* @tc.name: testHas032
* @tc.desc: Determine whether the HashSet instance contains the specified element. For example: hashSet.has.bind({}, "a")().
*/
it("testHas032", 0, function () {
let hashSet = new HashSet();
hashSet.add(4);
hashSet.add(1);
hashSet.add(3);
hashSet.add(2);
hashSet.add(5);
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.name: testAdd033
* @tc.desc: Add element to HashSet instance. For example: hashSet.add.bind({}, "a")().
*/
it("testAdd033", 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`);
}
});
});
}
......@@ -20,22 +20,21 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testConstructor001
* @tc.desc: Create an LightWeightSet instance. For example: let lightWeightSet = new LightWeightSet().
* @tc.author: wangyong
*/
it("testConstructor001", 0, function () {
try {
let lightWeightSet = new LightWeightSet();
expect(lightWeightSet != undefined).assertEqual(true);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("Cannot create new TreeMap");
expect(err.name).assertEqual("BusinessError");
expect(err.code).assertEqual(10200012);
expect(err.message).assertEqual("The LightWeightSet's constructor cannot be directly invoked");
}
});
/**
* @tc.name: testAdd002
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add(1).
* @tc.author: wangyong
*/
it("testAdd002", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -47,7 +46,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd003
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add("a").
* @tc.author: wangyong
*/
it("testAdd003", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -60,7 +58,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testAdd004
* @tc.desc: Add element to LightWeightSet instance.
* For example: let a = [1, 2, 3, 4]; lightWeightSet.add(a).
* @tc.author: wangyong
*/
it("testAdd004", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -74,7 +71,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testAdd005
* @tc.desc: Add element to LightWeightSet instance.
* For example: let a = {name: "lili", age: "13"}; lightWeightSet.add(a).
* @tc.author: wangyong
*/
it("testAdd005", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -87,7 +83,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd006
* @tc.desc: Add element to LightWeightSet instance. For example: let c = false; lightWeightSet.add(c).
* @tc.author: wangyong
*/
it("testAdd006", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -100,7 +95,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testLength007
* @tc.desc: Get the number of element in the LightWeightSet instance. For example: lightWeightSet.length.
* @tc.author: wangyong
*/
it("testLength007", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -116,7 +110,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAddAll008
* @tc.desc: Copy all element from one LightWeightSet to another.
* @tc.author: wangyong
*/
it("testAddAll008", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -144,7 +137,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testHasAll009
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
* @tc.author: wangyong
*/
it("testHasAll009", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -163,7 +155,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testHasAll010
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
* @tc.author: wangyong
*/
it("testHasAll010", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -181,7 +172,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testHas011
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
* @tc.author: wangyong
*/
it("testHas011", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -199,7 +189,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testEntries012
* @tc.desc: Get all key value pairs collection in lightWeightSet.
* @tc.author: wangyong
*/
it("testEntries012", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -219,7 +208,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testGetIndexOf013
* @tc.desc: Get the index according to the specified element. For example: lightWeightSet.getIndexOf(2).
* @tc.author: wangyong
*/
it("testGetIndexOf013", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -235,7 +223,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testIsEmpty014
* @tc.desc: Determine whether the lightWeightSet instance is empty. For example: lightWeightSet.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty014", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -251,7 +238,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testRemove015
* @tc.desc: Delete elements according to key. For example: lightWeightMap.remove(1).
* @tc.author: wangyong
*/
it("testRemove015", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -275,7 +261,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testRemoveAt016
* @tc.desc: Delete elements according to index. For example: lightWeightSet.removeAt(1).
* @tc.author: wangyong
*/
it("testRemoveAt016", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -299,7 +284,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testClear017
* @tc.desc: Clear all elements in LightWeightSet. For example: lightWeightSet.clear().
* @tc.author: wangyong
*/
it("testClear017", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -316,7 +300,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testForEach018
* @tc.desc: Traverse all elements in the LightWeightSet instance.
* @tc.author: wangyong
*/
it("testForEach018", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -339,7 +322,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testToString019
* @tc.desc: Use "," to splice the elements in the LightWeightSet instance into a string.
* For example: lightWeightSet.toString().
* @tc.author: wangyong
*/
it("testToString019", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -353,7 +335,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testToArray020
* @tc.desc: Convert an lightWeightSet instance to an array. For example: lightWeightSet.toArray().
* @tc.author: wangyong
*/
it("testToArray020", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -372,7 +353,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testGetValueAt021
* @tc.desc: Get the element according to the corresponding index. For example: lightWeightSet.getValueAt(1).
* @tc.author: wangyong
*/
it("testGetValueAt021", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -388,7 +368,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testIterator022
* @tc.desc: Iterate over all elements in the LightWeightSet.
* @tc.author: wangyong
*/
it("testIterator022", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -410,7 +389,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testValues023
* @tc.desc: Get a collection of all the values in the LightWeightSet. For example: lightWeightSet.values().
* @tc.author: wangyong
*/
it("testValues023", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -430,7 +408,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd024
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add(null).
* @tc.author: wangyong
*/
it("testAdd024", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -442,7 +419,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd025
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add(1.23).
* @tc.author: wangyong
*/
it("testAdd025", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -454,7 +430,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testHasAll026
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
* @tc.author: wangyong
*/
it("testHasAll026", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -473,7 +448,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testHasAll027
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
* @tc.author: wangyong
*/
it("testHasAll027", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -492,7 +466,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testRemove028
* @tc.desc: Delete elements according to key. For example: lightWeightMap.remove(3).
* @tc.author: wangyong
*/
it("testRemove028", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -503,7 +476,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testRemoveAt029
* @tc.desc: Delete elements according to index. For example: lightWeightSet.removeAt(1).
* @tc.author: wangyong
*/
it("testRemoveAt029", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -515,7 +487,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testIncreaseCapacityTo030
* @tc.desc: Expand the LightWeightSet capacity to the specified value.
* For example: lightWeightSet.increaseCapacityTo(3).
* @tc.author: wangyong
*/
it("testIncreaseCapacityTo030", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -526,9 +497,11 @@ describe("LightWeightSetTest", function () {
lightWeightSet.add(5);
try {
lightWeightSet.increaseCapacityTo(3);
expect(true).assertEqual(false);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
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`);
}
});
......@@ -536,7 +509,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testIncreaseCapacityTo031
* @tc.desc: Expand the LightWeightSet capacity to the specified value.
* For example: lightWeightSet.increaseCapacityTo("qwe").
* @tc.author: wangyong
*/
it("testIncreaseCapacityTo031", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -547,24 +519,27 @@ describe("LightWeightSetTest", function () {
lightWeightSet.add(5);
try {
let res = lightWeightSet.increaseCapacityTo("qwe");
expect(true).assertEqual(false);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
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.name: testRemoveAt032
* @tc.desc: Delete elements according to index. For example: lightWeightSet.removeAt("123").
* @tc.author: wangyong
* @tc.desc: Delete elements according to index. For example: lightWeightSet.removeAt("a").
*/
it("testRemoveAt032", 0, function () {
let lightWeightSet = new LightWeightSet();
try {
let res = lightWeightSet.removeAt("123");
let res = lightWeightSet.removeAt("a");
expect(true).assertEqual(false);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
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`);
}
});
......@@ -572,7 +547,6 @@ describe("LightWeightSetTest", function () {
* @tc.name: testIncreaseCapacityTo033
* @tc.desc: Expand the LightWeightSet capacity to the specified value.
* For example: lightWeightSet.increaseCapacityTo(20).
* @tc.author: wangyong
*/
it("testIncreaseCapacityTo033", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -587,8 +561,7 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testGetValueAt034
* @tc.desc: Get the element according to the corresponding index. For example: lightWeightSet.getValueAt("123").
* @tc.author: wangyong
* @tc.desc: Get the element according to the corresponding index. For example: lightWeightSet.getValueAt("a").
*/
it("testGetValueAt034", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -598,17 +571,18 @@ describe("LightWeightSetTest", function () {
lightWeightSet.add(4);
lightWeightSet.add(5);
try {
let res = lightWeightSet.getValueAt("123");
let res = lightWeightSet.getValueAt("a");
expect(true).assertEqual(false);
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
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.name: testIsEmpty035
* @tc.desc: Determine whether the lightWeightSet instance is empty. For example: lightWeightSet.isEmpty().
* @tc.author: wangyong
*/
it("testIsEmpty035", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -625,7 +599,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd036
* @tc.desc: Add element to LightWeightSet instance.
* @tc.author: wangyong
*/
it("testAdd036", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -641,7 +614,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd037
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add("").
* @tc.author: wangyong
*/
it("testAdd037", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -653,7 +625,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testAdd038
* @tc.desc: Add element to LightWeightSet instance. For example: lightWeightSet.add("$").
* @tc.author: wangyong
*/
it("testAdd038", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -665,7 +636,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testClear039
* @tc.desc: Clear all elements in LightWeightSet. For example: lightWeightSet.clear().
* @tc.author: wangyong
*/
it("testClear039", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -684,7 +654,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testRemove040
* @tc.desc: Delete elements according to key. For example: lightWeightMap.remove("A").
* @tc.author: wangyong
*/
it("testRemove040", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -693,18 +662,13 @@ describe("LightWeightSetTest", function () {
lightWeightSet.add(3);
lightWeightSet.add(4);
lightWeightSet.add(5);
try {
let res = lightWeightSet.remove("A");
} catch (err) {
expect(err.name).assertEqual("TypeError");
expect(err.message).assertEqual("the index is not integer");
}
let res = lightWeightSet.remove("A");
expect(res).assertEqual(undefined);
});
/**
* @tc.name: testIterator41
* @tc.desc: Iterate over all elements in the LightWeightSet.
* @tc.author: wangyong
*/
it("testIterator41", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -729,7 +693,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testEqual42
* @tc.desc: Compare lightweightmap and specified object for equality. For example: lightWeightSet.equal(obj).
* @tc.author: wangyong
*/
it("testEqual42", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -744,7 +707,6 @@ describe("LightWeightSetTest", function () {
/**
* @tc.name: testEqual43
* @tc.desc: Compare lightweightmap and specified object for equality. For example: lightWeightSet.equal(obj).
* @tc.author: wangyong
*/
it("testEqual43", 0, function () {
let lightWeightSet = new LightWeightSet();
......@@ -755,5 +717,43 @@ describe("LightWeightSetTest", function () {
let res = lightWeightSet.equal(obj);
expect(res).assertEqual(false);
});
/**
* @tc.name: testAddAll044
* @tc.desc: Copy all element from one LightWeightSet to another.
*/
it("testAddAll044", 0, function () {
let lightWeightSet = new LightWeightSet();
lightWeightSet.add(1);
lightWeightSet.add(2);
lightWeightSet.add(3);
try {
lightWeightSet.addAll([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 "set" must be LightWeightSet. Received value is: 1,2,3`);
}
});
/**
* @tc.name: testHasAll045
* @tc.desc: Judge whether a lightWeightSet contains all elements in another lightWeightSet.
*/
it("testHasAll045", 0, function () {
let lightWeightSet = new LightWeightSet();
lightWeightSet.add("a");
lightWeightSet.add("b");
lightWeightSet.add("c");
try {
lightWeightSet.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 "set" must be LightWeightSet. Received value is: 1,2,3`);
}
});
});
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册