提交 9d8609c5 编写于 作者: C cwx1148594

add xts for taskpool.execute(task, priority)

Signed-off-by: Ncwx1148594 <caolili14@huawei.com>
上级 40fd9b2c
...@@ -908,6 +908,23 @@ describe('ActsAbilityTest', function () { ...@@ -908,6 +908,23 @@ describe('ActsAbilityTest', function () {
done(); done();
}) })
it('TaskPoolTestClass061', 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 : TaskPoolTestClass049 * @tc.number : TaskPoolTestClass049
* @tc.name : Async Function Cancel task * @tc.name : Async Function Cancel task
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册