aboutsummaryrefslogtreecommitdiff
path: root/advtrains_interlocking/spec/signal_api_spec.lua
diff options
context:
space:
mode:
authorY. Wang <yw05@forksworld.de>2022-06-11 18:07:00 +0200
committerY. Wang <yw05@forksworld.de>2023-03-23 20:06:02 +0100
commit98c37108762c6d7c9f1d691b84f49bfa65b81b28 (patch)
tree32402fd5365d14470016562f16a5bc5f560eec87 /advtrains_interlocking/spec/signal_api_spec.lua
parentd1a0d8f2654d6ee64c1a43de7958b1eadfaff6b0 (diff)
downloadadvtrains-98c37108762c6d7c9f1d691b84f49bfa65b81b28.tar.gz
advtrains-98c37108762c6d7c9f1d691b84f49bfa65b81b28.tar.bz2
advtrains-98c37108762c6d7c9f1d691b84f49bfa65b81b28.zip
Implement primitive distant signaling
Diffstat (limited to 'advtrains_interlocking/spec/signal_api_spec.lua')
-rw-r--r--advtrains_interlocking/spec/signal_api_spec.lua49
1 files changed, 0 insertions, 49 deletions
diff --git a/advtrains_interlocking/spec/signal_api_spec.lua b/advtrains_interlocking/spec/signal_api_spec.lua
deleted file mode 100644
index cd7a1d1..0000000
--- a/advtrains_interlocking/spec/signal_api_spec.lua
+++ /dev/null
@@ -1,49 +0,0 @@
-require("mineunit")
-
-mineunit("core")
-
-_G.advtrains = {
- interlocking = {
- aspects = fixture("../../signal_aspects"),
- },
- ndb = {
- get_node = minetest.get_node,
- }
-}
-
-fixture("advtrains_helpers")
-fixture("../../database")
-sourcefile("signal_api")
-
-local stub_aspect_t1 = { main = math.random() }
-local stub_pos_t1 = {x = 1, y = 0, z = 1}
-
-minetest.register_node(":stubsignal_t1", {
- advtrains = {
- supported_aspects = {},
- get_aspect = function () return stub_aspect_t1 end,
- set_aspect = function () end,
- },
- groups = { advtrains_signal = 2 },
-})
-
-world.layout {
- {stub_pos_t1, "stubsignal_t1"},
-}
-
-describe("API for supposed signal aspects", function()
- it("should load and save data properly", function()
- local tbl = {_foo = true}
- advtrains.interlocking.load_supposed_aspects(tbl)
- assert.same(tbl, advtrains.interlocking.save_supposed_aspects())
- end)
- it("should set and get type 1 signals properly", function ()
- local pos = stub_pos_t1
- local asp = stub_aspect_t1
- local newasp = { dst = math.random() }
- assert.same(asp, advtrains.interlocking.signal_get_aspect(pos))
- advtrains.interlocking.signal_set_aspect(pos, newasp)
- assert.same(newasp, advtrains.interlocking.signal_get_aspect(pos))
- assert.same(asp, advtrains.interlocking.signal_get_real_aspect(pos))
- end)
-end)