summaryrefslogtreecommitdiff
path: root/tests/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2019-11-28 00:35:38 +0800
committerruki <[email protected]>2019-11-27 21:33:51 +0800
commit6cde799f0a1ebb3151e0880299a0dce75567f764 (patch)
tree9beb0cfc307a846339ab9f83b689aa37e0da0b52 /tests/modules
parent9853d490347eac8337eaf28eb23cf414a76cdcf7 (diff)
add tests for scheduler
Diffstat (limited to 'tests/modules')
-rw-r--r--tests/modules/scheduler/test.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/modules/scheduler/test.lua b/tests/modules/scheduler/test.lua
new file mode 100644
index 000000000..d61b663e3
--- /dev/null
+++ b/tests/modules/scheduler/test.lua
@@ -0,0 +1,18 @@
+import("core.base.scheduler")
+
+function test_runjobs(t)
+
+ local count = 0
+ local task = function (a)
+ t:are_equal(a, "xmake!")
+ count = count + 1
+ coroutine.yield()
+ end
+ for i = 1, 100 do
+ scheduler.run(task, "xmake!")
+ end
+ scheduler.runloop()
+ t:are_equal(count, 100)
+end
+
+