diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-03 10:26:47 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-12-03 10:26:47 +0100 |
commit | 307fd830eb168005a3ba3d557343284814757eff (patch) | |
tree | eb14512492d58e33585bc5df3f3d9b23d7308934 /tests | |
parent | ca7657e24549acb8a2dd45fa81c309b5bf9f61ee (diff) | |
download | lanes-307fd830eb168005a3ba3d557343284814757eff.tar.gz lanes-307fd830eb168005a3ba3d557343284814757eff.tar.bz2 lanes-307fd830eb168005a3ba3d557343284814757eff.zip |
New method linda:restrict()
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cancel.lua | 11 | ||||
-rw-r--r-- | tests/fifo.lua | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/cancel.lua b/tests/cancel.lua index 1984c85..e65d794 100644 --- a/tests/cancel.lua +++ b/tests/cancel.lua | |||
@@ -39,10 +39,17 @@ if not next(which_tests) or which_tests.genlock then | |||
39 | local lock = lanes.genlock( linda, "lock", 1) | 39 | local lock = lanes.genlock( linda, "lock", 1) |
40 | local atomic = lanes.genatomic( linda, "atomic") | 40 | local atomic = lanes.genatomic( linda, "atomic") |
41 | 41 | ||
42 | local check_returned_cancel_error = function(_status, _err) | ||
43 | assert(_status == nil and _err == lanes.cancel_error) | ||
44 | end | ||
42 | -- check that cancelled lindas give cancel_error as they should | 45 | -- check that cancelled lindas give cancel_error as they should |
43 | linda:cancel() | 46 | linda:cancel() |
44 | local _status, _err = linda:get( "empty") | 47 | check_returned_cancel_error(linda:set( "empty", 42)) |
45 | assert(_status == nil and _err == lanes.cancel_error) | 48 | check_returned_cancel_error(linda:get( "empty")) |
49 | check_returned_cancel_error(linda:send( "empty", 42)) | ||
50 | check_returned_cancel_error(linda:receive( "empty")) | ||
51 | check_returned_cancel_error(linda:limit( "empty", 5)) | ||
52 | check_returned_cancel_error(linda:restrict( "empty", "set/get")) | ||
46 | assert( lanes.genlock( linda, "any", 1) == lanes.cancel_error) | 53 | assert( lanes.genlock( linda, "any", 1) == lanes.cancel_error) |
47 | assert( lanes.genatomic( linda, "any") == lanes.cancel_error) | 54 | assert( lanes.genatomic( linda, "any") == lanes.cancel_error) |
48 | 55 | ||
diff --git a/tests/fifo.lua b/tests/fifo.lua index e1bfeae..9efcbd9 100644 --- a/tests/fifo.lua +++ b/tests/fifo.lua | |||
@@ -60,7 +60,7 @@ for key,count in pairs(fifo_linda:count("unknown key", A.channel, "unknown key", | |||
60 | end | 60 | end |
61 | print "Dumping linda stats.. [4]" -- count everything | 61 | print "Dumping linda stats.. [4]" -- count everything |
62 | for key,contents in pairs(fifo_linda:dump()) do | 62 | for key,contents in pairs(fifo_linda:dump()) do |
63 | print("channel " .. key .. ": limit=".. contents.limit, " first=" .. contents.first, " count=" .. contents.count) | 63 | print("channel " .. key .. ": limit=".. contents.limit, " first=" .. contents.first, " count=" .. contents.count .. " restrict=" .. contents.restrict) |
64 | for k,v in pairs(contents.fifo) do | 64 | for k,v in pairs(contents.fifo) do |
65 | print("[".. k.."] = " .. v) | 65 | print("[".. k.."] = " .. v) |
66 | end | 66 | end |