aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/basic.lua4
-rw-r--r--tests/errhangtest.lua9
-rw-r--r--tests/linda_perf.lua8
-rw-r--r--tests/protect_allocator.lua2
4 files changed, 11 insertions, 12 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index 170e821..a9c85cc 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -209,7 +209,7 @@ PRINT "wait_receive_lane is cancelled"
209local wait_receive_batched = function() 209local wait_receive_batched = function()
210 local k, v1, v2 210 local k, v1, v2
211 set_finalizer(function() print("wait_receive_batched", k, v1, v2) end) 211 set_finalizer(function() print("wait_receive_batched", k, v1, v2) end)
212 k, v1, v2 = limited:receive(limited.batched, "dummy", 2) -- infinite timeout, returns only when lane is cancelled 212 k, v1, v2 = limited:receive_batched("dummy", 2) -- infinite timeout, returns only when lane is cancelled
213end 213end
214 214
215local wait_receive_batched_lane = lanes.gen("*", { name = 'auto' }, wait_receive_batched)() 215local wait_receive_batched_lane = lanes.gen("*", { name = 'auto' }, wait_receive_batched)()
@@ -273,7 +273,7 @@ local b,x,y,z,w = linda:get("<->", 4)
273assert(b == 3 and x == "x" and y == "y" and z == "z" and w == nil) 273assert(b == 3 and x == "x" and y == "y" and z == "z" and w == nil)
274local k, x = linda:receive("<->") 274local k, x = linda:receive("<->")
275assert(k == "<->" and x == "x") 275assert(k == "<->" and x == "x")
276local k,y,z = linda:receive(linda.batched, "<->", 2) 276local k,y,z = linda:receive_batched("<->", 2)
277assert(k == "<->" and y == "y" and z == "z") 277assert(k == "<->" and y == "y" and z == "z")
278linda:set("<->") 278linda:set("<->")
279local b,x,y,z,w = linda:get("<->", 4) 279local b,x,y,z,w = linda:get("<->", 4)
diff --git a/tests/errhangtest.lua b/tests/errhangtest.lua
index fff0dee..5b3f0c0 100644
--- a/tests/errhangtest.lua
+++ b/tests/errhangtest.lua
@@ -19,7 +19,6 @@ end
19if true then 19if true then
20 print "\n#### reserved sentinels" 20 print "\n#### reserved sentinels"
21 print(pcall(linda.set, linda, lanes.cancel_error)) 21 print(pcall(linda.set, linda, lanes.cancel_error))
22 print(pcall(linda.set, linda, linda.batched))
23 local _count, _val = linda:get("test") 22 local _count, _val = linda:get("test")
24 assert(_count == 0 and _val == nil) 23 assert(_count == 0 and _val == nil)
25 print "OK" 24 print "OK"
@@ -28,13 +27,13 @@ end
28-- get/set a few values 27-- get/set a few values
29if true then 28if true then
30 print "\n#### set 3 -> receive batched" 29 print "\n#### set 3 -> receive batched"
31 assert.fails(function() linda:receive(linda.batched, "some key", -1, 1) end) 30 assert.fails(function() linda:receive_batched("some key", -1, 1) end)
32 assert.fails(function() linda:receive(linda.batched, "some key", 2, 1) end) 31 assert.fails(function() linda:receive_batched("some key", 2, 1) end)
33 assert.failsnot(function() linda:receive(0, linda.batched, "some key", 1, 3) end) 32 assert.failsnot(function() linda:receive_batched(0, "some key", 1, 3) end)
34 local fun = function() print "function test ok" end 33 local fun = function() print "function test ok" end
35 print(pcall(linda.set, linda, 'test', true, nil, fun)) 34 print(pcall(linda.set, linda, 'test', true, nil, fun))
36 -- read back the contents 35 -- read back the contents
37 local k,b,n,f = linda:receive(linda.batched, 'test', 3) 36 local k,b,n,f = linda:receive_batched('test', 3)
38 local _count, _val = linda:get("test") 37 local _count, _val = linda:get("test")
39 assert(_count == 0 and _val == nil) 38 assert(_count == 0 and _val == nil)
40 -- check they are ok 39 -- check they are ok
diff --git a/tests/linda_perf.lua b/tests/linda_perf.lua
index bba1408..107fd25 100644
--- a/tests/linda_perf.lua
+++ b/tests/linda_perf.lua
@@ -68,7 +68,7 @@ local gobbler = function( l, loop, batch)
68 l:receive( "go") 68 l:receive( "go")
69 -- eat data in batches 69 -- eat data in batches
70 for i = 1, loop/batch do 70 for i = 1, loop/batch do
71 l:receive( l.batched, "key", batch) 71 l:receive_batched("key", batch)
72 -- print("gobbler:", batch) 72 -- print("gobbler:", batch)
73 end 73 end
74 print "loop is over" 74 print "loop is over"
@@ -168,9 +168,9 @@ local function ziva2( preloop, loop, batch)
168 local l = lanes.linda("ziva2("..preloop..":"..loop..":"..tostring(batch)..")", group_uid) 168 local l = lanes.linda("ziva2("..preloop..":"..loop..":"..tostring(batch)..")", group_uid)
169 group_uid = (group_uid % config.nb_user_keepers) + 1 169 group_uid = (group_uid % config.nb_user_keepers) + 1
170 -- prefill the linda a bit to increase fifo stress 170 -- prefill the linda a bit to increase fifo stress
171 local top, step = math.max( preloop, loop), (l.batched and batch) and batch or 1 171 local top, step = math.max( preloop, loop), batch or 1
172 local batch_send, batch_read 172 local batch_send, batch_read
173 if l.batched and batch then 173 if batch then
174 local batch_values = {} 174 local batch_values = {}
175 for i = 1, batch do 175 for i = 1, batch do
176 table.insert( batch_values, i) 176 table.insert( batch_values, i)
@@ -180,7 +180,7 @@ local function ziva2( preloop, loop, batch)
180 l:send( "key", table_unpack( batch_values)) 180 l:send( "key", table_unpack( batch_values))
181 end 181 end
182 batch_read = function() 182 batch_read = function()
183 l:receive( l.batched, "key", batch) 183 l:receive_batched("key", batch)
184 end 184 end
185 else -- not batched 185 else -- not batched
186 batch_send = function() 186 batch_send = function()
diff --git a/tests/protect_allocator.lua b/tests/protect_allocator.lua
index e13a57c..325726a 100644
--- a/tests/protect_allocator.lua
+++ b/tests/protect_allocator.lua
@@ -52,7 +52,7 @@ end
52 52
53-- wait for completion 53-- wait for completion
54print "wait for completion" 54print "wait for completion"
55linda:receive( linda.batched, "key", COUNT) 55linda:receive_batched("key", COUNT)
56print "waiting a bit more ..." 56print "waiting a bit more ..."
57SLEEP(1) 57SLEEP(1)
58print "SUCCESS" 58print "SUCCESS"