aboutsummaryrefslogtreecommitdiff
path: root/tests/basic.lua
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/basic.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/tests/basic.lua b/tests/basic.lua
index bdad44c..ae8ebd9 100644
--- a/tests/basic.lua
+++ b/tests/basic.lua
@@ -252,21 +252,21 @@ assert(type(linda) == "userdata" and tostring(linda) == "Linda: communications")
252 252
253WR "test linda:get/set..." 253WR "test linda:get/set..."
254linda:set("<->", "x", "y", "z") 254linda:set("<->", "x", "y", "z")
255local x,y,z = linda:get("<->", 1) 255local b,x,y,z = linda:get("<->", 1)
256assert(x == "x" and y == nil and z == nil) 256assert(b == 1 and x == "x" and y == nil and z == nil)
257local x,y,z = linda:get("<->", 2) 257local b,x,y,z = linda:get("<->", 2)
258assert(x == "x" and y == "y" and z == nil) 258assert(b == 2 and x == "x" and y == "y" and z == nil)
259local x,y,z = linda:get("<->", 3) 259local b,x,y,z = linda:get("<->", 3)
260assert(x == "x" and y == "y" and z == "z") 260assert(b == 3 and x == "x" and y == "y" and z == "z")
261local x,y,z,w = linda:get("<->", 4) 261local b,x,y,z,w = linda:get("<->", 4)
262assert(x == "x" and y == "y" and z == "z" and w == nil) 262assert(b == 3 and x == "x" and y == "y" and z == "z" and w == nil)
263local k, x = linda:receive("<->") 263local k, x = linda:receive("<->")
264assert(k == "<->" and x == "x") 264assert(k == "<->" and x == "x")
265local k,y,z = linda:receive(linda.batched, "<->", 2) 265local k,y,z = linda:receive(linda.batched, "<->", 2)
266assert(k == "<->" and y == "y" and z == "z") 266assert(k == "<->" and y == "y" and z == "z")
267linda:set("<->") 267linda:set("<->")
268local x,y,z,w = linda:get("<->", 4) 268local b,x,y,z,w = linda:get("<->", 4)
269assert(x == nil and y == nil and z == nil and w == nil) 269assert(b == 0 and x == nil and y == nil and z == nil and w == nil)
270WR "ok\n" 270WR "ok\n"
271 271
272local function PEEK(...) return linda:get("<-", ...) end 272local function PEEK(...) return linda:get("<-", ...) end
@@ -282,7 +282,7 @@ SEND(setmetatable({"should be ignored"},{__lanesconvert=lanes.null})); WR("main
282for i=1,40 do 282for i=1,40 do
283 WR "." 283 WR "."
284 SLEEP(0.0001) 284 SLEEP(0.0001)
285 assert(PEEK() == nil) -- nothing coming in, yet 285 assert(PEEK() == 0) -- nothing coming in, yet
286end 286end
287SEND(nil); WR("\nmain ", "nil sent\n") 287SEND(nil); WR("\nmain ", "nil sent\n")
288 288
@@ -306,7 +306,7 @@ assert(null==nil)
306local out_t = RECEIVE(); WR(type(out_t).." received\n") 306local out_t = RECEIVE(); WR(type(out_t).." received\n")
307assert(tables_match(out_t, {'a','b','c',d=10})) 307assert(tables_match(out_t, {'a','b','c',d=10}))
308 308
309assert(PEEK() == nil) 309assert(PEEK() == 0)
310SEND(4) 310SEND(4)
311 311
312local complex_table = RECEIVE(); WR(type(complex_table).." received\n") 312local complex_table = RECEIVE(); WR(type(complex_table).." received\n")