summaryrefslogtreecommitdiff
path: root/tests/modules/scheduler/test.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-05 00:34:53 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit94d3eb649e489a597a2f5d966d2249a9e64d87e3 (patch)
treec5bb5c3286c64a5ca491b2aacc0c09a4c9cc84ba /tests/modules/scheduler/test.lua
parenta615d353a701e0d23e322060e5dd8e364d38dfee (diff)
impl private.async.runjobs
Diffstat (limited to 'tests/modules/scheduler/test.lua')
-rw-r--r--tests/modules/scheduler/test.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua
index de62e47ed..853957567 100644
--- a/tests/modules/scheduler/test.lua
+++ b/tests/modules/scheduler/test.lua
@@ -1,6 +1,6 @@
import("core.base.scheduler")
-function test_runjobs(t)
+function test_group(t)
local count = 0
local task = function (a)
@@ -46,3 +46,16 @@ function test_yield(t)
scheduler.co_group_wait("test")
t:are_equal(count, 10)
end
+
+function test_runjobs(t)
+ import("private.async.runjobs")
+
+ local total = 100
+ local comax = 6
+ local count = 0
+ runjobs("test", function (index)
+ t:require(index >= 1 and index <= total)
+ count = count + 1
+ end, total, comax)
+ t:are_equal(count, total)
+end