More parameter verb-call checks
Signed-off-by: Rahix <rahix@rahix.de>
This commit is contained in:
parent
dc0e021ef6
commit
9c32c826ea
1 changed files with 17 additions and 3 deletions
18
test_bc.lua
18
test_bc.lua
|
|
@ -64,9 +64,14 @@ function test_call_verb()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_multinode_call_verb()
|
function test_multinode_call_verb()
|
||||||
local bc1 = bc:init({["light0"]=true}, {["toggle_light0"]=function(b)
|
local bc1 = bc:init({["light0"]=true}, {
|
||||||
|
["toggle_light0"]=function(b)
|
||||||
b:set_noun("light0", not b:get_noun("light0"))
|
b:set_noun("light0", not b:get_noun("light0"))
|
||||||
end})
|
end,
|
||||||
|
["set_light0"]=function(b, state)
|
||||||
|
b:set_noun("light0", state)
|
||||||
|
end,
|
||||||
|
})
|
||||||
local a1 = network.get_scene()
|
local a1 = network.get_scene()
|
||||||
local bc2 = bc:init({}, {})
|
local bc2 = bc:init({}, {})
|
||||||
local a2 = network.get_scene()
|
local a2 = network.get_scene()
|
||||||
|
|
@ -80,6 +85,15 @@ function test_multinode_call_verb()
|
||||||
|
|
||||||
network.set_scene(a1)
|
network.set_scene(a1)
|
||||||
assert_equal(true, bc1:get_noun("light0"), "Second verb invocation did not go to plan")
|
assert_equal(true, bc1:get_noun("light0"), "Second verb invocation did not go to plan")
|
||||||
|
|
||||||
|
-- Check calling with parameter
|
||||||
|
for _, b in pairs({true, false}) do
|
||||||
|
network.set_scene(a2)
|
||||||
|
assert_true(bc2:call_verb("set_light0", b))
|
||||||
|
|
||||||
|
network.set_scene(a1)
|
||||||
|
assert_equal(b, bc1:get_noun("light0"), "Parameter verb invocation did not go to plan")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_multinode_get_noun()
|
function test_multinode_get_noun()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue