diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-30 17:57:21 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-30 17:57:21 +0200 |
commit | 731556711e453a501f1d1d06a6013b8fbd53414e (patch) | |
tree | 4c5c28cd83de320fcf4c9b4c749f2e6e8d5bef48 /tests/fibonacci.lua | |
parent | a156aaeb07fada043b308409dcffcae1726eec0b (diff) | |
download | lanes-731556711e453a501f1d1d06a6013b8fbd53414e.tar.gz lanes-731556711e453a501f1d1d06a6013b8fbd53414e.tar.bz2 lanes-731556711e453a501f1d1d06a6013b8fbd53414e.zip |
Keeper management modernisation and improvements
* use a std::variant to manage the distinction between one or more keeper states. Use std::unique_ptr<Keeper[]> to manage the multiple keeper case.
* setting "nb_keepers" renamed "nb_user_keepers", to indicate these are in addition to internal keeper #0 used for timers.
* stricter lanes.linda() argument checking. group is imposed if more than one keeper is used.
* more tests
Diffstat (limited to 'tests/fibonacci.lua')
-rw-r--r-- | tests/fibonacci.lua | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/fibonacci.lua b/tests/fibonacci.lua index 6dba1dd..0ff2f37 100644 --- a/tests/fibonacci.lua +++ b/tests/fibonacci.lua | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | -- Need to say it's 'local' so it can be an upvalue | 13 | -- Need to say it's 'local' so it can be an upvalue |
14 | -- | 14 | -- |
15 | local lanes = require "lanes".configure{ nb_keepers =1, with_timers = false} | 15 | local lanes = require "lanes".configure() |
16 | 16 | ||
17 | local function WR(str) | 17 | local function WR(str) |
18 | io.stderr:write( str.."\n" ) | 18 | io.stderr:write( str.."\n" ) |
@@ -27,7 +27,7 @@ local KNOWN= { [0]=0, 1,1,2,3,5,8,13,21,34,55,89,144 } | |||
27 | set_debug_threadname = function ( ...) | 27 | set_debug_threadname = function ( ...) |
28 | end | 28 | end |
29 | 29 | ||
30 | -- | 30 | -- |
31 | -- uint= fib( n_uint ) | 31 | -- uint= fib( n_uint ) |
32 | -- | 32 | -- |
33 | local function fib( n ) | 33 | local function fib( n ) |
@@ -72,20 +72,20 @@ end | |||
72 | -- | 72 | -- |
73 | local right= | 73 | local right= |
74 | { | 74 | { |
75 | 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, | 75 | 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, 17711, |
76 | 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, | 76 | 28657, 46368, 75025, 121393, 196418, 317811, 514229, 832040, 1346269, 2178309, 3524578, 5702887, |
77 | 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, | 77 | 9227465, 14930352, 24157817, 39088169, 63245986, 102334155, 165580141, 267914296, 433494437, |
78 | 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, | 78 | 701408733, 1134903170, 1836311903, 2971215073, 4807526976, 7778742049, 12586269025, 20365011074, |
79 | 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162, 591286729879, | 79 | 32951280099, 53316291173, 86267571272, 139583862445, 225851433717, 365435296162, 591286729879, |
80 | 956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, | 80 | 956722026041, 1548008755920, 2504730781961, 4052739537881, 6557470319842, 10610209857723, |
81 | 17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994, 190392490709135, | 81 | 17167680177565, 27777890035288, 44945570212853, 72723460248141, 117669030460994, 190392490709135, |
82 | 308061521170129, 498454011879264, 806515533049393, 1304969544928657, 2111485077978050, | 82 | 308061521170129, 498454011879264, 806515533049393, 1304969544928657, 2111485077978050, |
83 | 3416454622906707, 5527939700884757, 8944394323791464, 14472334024676220, 23416728348467684, | 83 | 3416454622906707, 5527939700884757, 8944394323791464, 14472334024676220, 23416728348467684, |
84 | 37889062373143900, 61305790721611580, 99194853094755490, 160500643816367070, 259695496911122560, | 84 | 37889062373143900, 61305790721611580, 99194853094755490, 160500643816367070, 259695496911122560, |
85 | 420196140727489660, 679891637638612200, 1100087778366101900, 1779979416004714000, | 85 | 420196140727489660, 679891637638612200, 1100087778366101900, 1779979416004714000, |
86 | 2880067194370816000, 4660046610375530000, 7540113804746346000, 12200160415121877000, | 86 | 2880067194370816000, 4660046610375530000, 7540113804746346000, 12200160415121877000, |
87 | 19740274219868226000, 31940434634990105000, 51680708854858334000, 83621143489848440000, | 87 | 19740274219868226000, 31940434634990105000, 51680708854858334000, 83621143489848440000, |
88 | 135301852344706780000, 218922995834555200000 | 88 | 135301852344706780000, 218922995834555200000 |
89 | } | 89 | } |
90 | assert( #right==99 ) | 90 | assert( #right==99 ) |
91 | 91 | ||