diff options
Diffstat (limited to '')
-rw-r--r-- | tests/basic.lua | 24 |
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 | ||
253 | WR "test linda:get/set..." | 253 | WR "test linda:get/set..." |
254 | linda:set("<->", "x", "y", "z") | 254 | linda:set("<->", "x", "y", "z") |
255 | local x,y,z = linda:get("<->", 1) | 255 | local b,x,y,z = linda:get("<->", 1) |
256 | assert(x == "x" and y == nil and z == nil) | 256 | assert(b == 1 and x == "x" and y == nil and z == nil) |
257 | local x,y,z = linda:get("<->", 2) | 257 | local b,x,y,z = linda:get("<->", 2) |
258 | assert(x == "x" and y == "y" and z == nil) | 258 | assert(b == 2 and x == "x" and y == "y" and z == nil) |
259 | local x,y,z = linda:get("<->", 3) | 259 | local b,x,y,z = linda:get("<->", 3) |
260 | assert(x == "x" and y == "y" and z == "z") | 260 | assert(b == 3 and x == "x" and y == "y" and z == "z") |
261 | local x,y,z,w = linda:get("<->", 4) | 261 | local b,x,y,z,w = linda:get("<->", 4) |
262 | assert(x == "x" and y == "y" and z == "z" and w == nil) | 262 | assert(b == 3 and x == "x" and y == "y" and z == "z" and w == nil) |
263 | local k, x = linda:receive("<->") | 263 | local k, x = linda:receive("<->") |
264 | assert(k == "<->" and x == "x") | 264 | assert(k == "<->" and x == "x") |
265 | local k,y,z = linda:receive(linda.batched, "<->", 2) | 265 | local k,y,z = linda:receive(linda.batched, "<->", 2) |
266 | assert(k == "<->" and y == "y" and z == "z") | 266 | assert(k == "<->" and y == "y" and z == "z") |
267 | linda:set("<->") | 267 | linda:set("<->") |
268 | local x,y,z,w = linda:get("<->", 4) | 268 | local b,x,y,z,w = linda:get("<->", 4) |
269 | assert(x == nil and y == nil and z == nil and w == nil) | 269 | assert(b == 0 and x == nil and y == nil and z == nil and w == nil) |
270 | WR "ok\n" | 270 | WR "ok\n" |
271 | 271 | ||
272 | local function PEEK(...) return linda:get("<-", ...) end | 272 | local function PEEK(...) return linda:get("<-", ...) end |
@@ -282,7 +282,7 @@ SEND(setmetatable({"should be ignored"},{__lanesconvert=lanes.null})); WR("main | |||
282 | for i=1,40 do | 282 | for 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 |
286 | end | 286 | end |
287 | SEND(nil); WR("\nmain ", "nil sent\n") | 287 | SEND(nil); WR("\nmain ", "nil sent\n") |
288 | 288 | ||
@@ -306,7 +306,7 @@ assert(null==nil) | |||
306 | local out_t = RECEIVE(); WR(type(out_t).." received\n") | 306 | local out_t = RECEIVE(); WR(type(out_t).." received\n") |
307 | assert(tables_match(out_t, {'a','b','c',d=10})) | 307 | assert(tables_match(out_t, {'a','b','c',d=10})) |
308 | 308 | ||
309 | assert(PEEK() == nil) | 309 | assert(PEEK() == 0) |
310 | SEND(4) | 310 | SEND(4) |
311 | 311 | ||
312 | local complex_table = RECEIVE(); WR(type(complex_table).." received\n") | 312 | local complex_table = RECEIVE(); WR(type(complex_table).." received\n") |