diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-02 18:21:24 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-07-02 18:21:24 +0200 |
| commit | 2bc1eee14394d1c277b2dfc3a68e591c4bef66a9 (patch) | |
| tree | d9f3f6acc9135732b4a5eb54f7abe9fba258f346 | |
| parent | 4536b4d5f94fc7d94f0c613780ca6a09e00edccd (diff) | |
| download | lanes-2bc1eee14394d1c277b2dfc3a68e591c4bef66a9.tar.gz lanes-2bc1eee14394d1c277b2dfc3a68e591c4bef66a9.tar.bz2 lanes-2bc1eee14394d1c277b2dfc3a68e591c4bef66a9.zip | |
Improved recursive.lua
| -rw-r--r-- | tests/recursive.lua | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/recursive.lua b/tests/recursive.lua index 97b9c5b..716fe60 100644 --- a/tests/recursive.lua +++ b/tests/recursive.lua | |||
| @@ -4,18 +4,18 @@ | |||
| 4 | -- Test program for Lua Lanes | 4 | -- Test program for Lua Lanes |
| 5 | -- | 5 | -- |
| 6 | 6 | ||
| 7 | io.stderr:write( "depth:" ) | 7 | io.stderr:write("depth: ") |
| 8 | local function func( depth ) | 8 | local function func( depth ) |
| 9 | io.stderr:write(" " .. depth) | 9 | io.stderr:write(depth .. " ") |
| 10 | if depth > 10 then | 10 | if depth <= 0 then |
| 11 | return "done!" | 11 | return "done!" |
| 12 | end | 12 | end |
| 13 | 13 | ||
| 14 | local lanes = require "lanes" | 14 | local lanes = require "lanes" |
| 15 | local lane = lanes.gen("*", func)( depth+1 ) | 15 | local lane = lanes.gen("*", func)( depth-1 ) |
| 16 | return lane[1] | 16 | return lane[1] |
| 17 | end | 17 | end |
| 18 | 18 | ||
| 19 | local v= func(0) | 19 | local v= func(100) |
| 20 | assert(v=="done!") | 20 | assert(v=="done!") |
| 21 | io.stderr:write("TEST OK\n") | 21 | io.stderr:write("TEST OK\n") |
