aboutsummaryrefslogtreecommitdiff
path: root/tests/recursive.lua
blob: e2941049a7460acaef24c071fcea80916c5041d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--
-- RECURSIVE.LUA
--
-- Test program for Lua Lanes
--

io.stderr:write("depth: ")
local function func( depth )
    io.stderr:write(depth .. " ")
    if depth <= 0 then
        return "done!"
    end

    local lanes = require "lanes"
    local lane = lanes.gen("*", { name = 'auto' }, func)( depth-1 )
    return lane[1]
end

local v= func(100)
assert(v=="done!")
io.stderr:write("TEST OK\n")