aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/spec/basic_signalling_spec.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2023-01-06 18:23:15 +0100
committerY. Wang <yw05@forksworld.de>2023-03-23 20:06:02 +0100
commitd443d8e07af89665a6bb3d87af91f43f08a6c47e (patch)
treeccb18a6ba184ec5b08835ed2762e680a1cb44f01 /advtrains_interlocking/spec/basic_signalling_spec.lua
parent2d072cdc67ec3018eaba36b7c79c2b19e574a94d (diff)
downloadadvtrains-d443d8e07af89665a6bb3d87af91f43f08a6c47e.tar.gz
advtrains-d443d8e07af89665a6bb3d87af91f43f08a6c47e.tar.bz2
advtrains-d443d8e07af89665a6bb3d87af91f43f08a6c47e.zip
Distant signaling: avoid signal signs
Diffstat (limited to 'advtrains_interlocking/spec/basic_signalling_spec.lua')
-rw-r--r--advtrains_interlocking/spec/basic_signalling_spec.lua17
1 files changed, 16 insertions, 1 deletions
diff --git a/advtrains_interlocking/spec/basic_signalling_spec.lua b/advtrains_interlocking/spec/basic_signalling_spec.lua
index 720b274..cce0f15 100644
--- a/advtrains_interlocking/spec/basic_signalling_spec.lua
+++ b/advtrains_interlocking/spec/basic_signalling_spec.lua
@@ -23,6 +23,12 @@ sourcefile("signal_api")
sourcefile("signal_aspect_accessors")
fixture("../../demosignals")
+minetest.register_node("advtrains_interlocking:signal_sign", {
+ advtrains = {
+ get_aspcet = function() return {main = 19} end
+ }
+})
+
local D = advtrains.distant
local I = advtrains.interlocking
@@ -32,7 +38,7 @@ local stub_aspect_t1 = {
danger = {main = 0, shunt = false},
}
local stub_pos_t1 = {}
-for i = 1, 3 do
+for i = 1, 4 do
stub_pos_t1[i] = {x = 1, y = 0, z = i}
end
@@ -40,6 +46,7 @@ world.layout {
{stub_pos_t1[1], "advtrains_interlocking:ds_danger"},
{stub_pos_t1[2], "advtrains_interlocking:ds_slow"},
{stub_pos_t1[3], "advtrains_interlocking:ds_free"},
+ {stub_pos_t1[4], "advtrains_interlocking:signal_sign"},
}
describe("API for supposed signal aspects", function()
@@ -84,4 +91,12 @@ describe("Distant signaling", function()
assert.same({}, {D.get_main(stub_pos_t1[3])})
assert.same(stub_aspect_t1.free, I.signal_get_aspect(stub_pos_t1[3]))
end)
+ it("should reject signal signs", function()
+ D.assign(stub_pos_t1[1], stub_pos_t1[4])
+ assert.same({}, D.get_dst(stub_pos_t1[1]))
+ assert.same({}, {D.get_main(stub_pos_t1[4])})
+ D.assign(stub_pos_t1[4], stub_pos_t1[1])
+ assert.same({}, D.get_dst(stub_pos_t1[4]))
+ assert.same({}, {D.get_main(stub_pos_t1[1])})
+ end)
end)