diff options
author | Peter Drahoš <drahosp@gmail.com> | 2010-10-01 03:22:32 +0200 |
---|---|---|
committer | Peter Drahoš <drahosp@gmail.com> | 2010-10-01 03:22:32 +0200 |
commit | 89d9c98af1ac352ba4d49d660e61b0853d6e1a86 (patch) | |
tree | 15c56d2ce66b4ab147171c0f674cdb4a435ff13f /tests/recursive.lua | |
download | lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.gz lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.tar.bz2 lanes-89d9c98af1ac352ba4d49d660e61b0853d6e1a86.zip |
Import to git
Diffstat (limited to 'tests/recursive.lua')
-rw-r--r-- | tests/recursive.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/recursive.lua b/tests/recursive.lua new file mode 100644 index 0000000..49c03d3 --- /dev/null +++ b/tests/recursive.lua | |||
@@ -0,0 +1,21 @@ | |||
1 | -- | ||
2 | -- RECURSIVE.LUA | ||
3 | -- | ||
4 | -- Test program for Lua Lanes | ||
5 | -- | ||
6 | |||
7 | io.stderr:write( "depth:" ) | ||
8 | local function func( depth ) | ||
9 | io.stderr:write(" " .. depth) | ||
10 | if depth > 10 then | ||
11 | return "done!" | ||
12 | end | ||
13 | |||
14 | require "lanes" | ||
15 | local lane= lanes.gen("*", func)( depth+1 ) | ||
16 | return lane[1] | ||
17 | end | ||
18 | |||
19 | local v= func(0) | ||
20 | assert(v=="done!") | ||
21 | io.stderr:write("\n") | ||