t/html; charset=UTF-8 Last-Modified: Tue, 01 Dec 2026 16:07:16 GMT Expires: Fri, 28 Nov 2036 16:07:16 GMT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 -- test the serialization function package.path = "../?.lua;" .. package.path _G.advtrains = {} _G.advtrains.interlocking = {} require("ars") local arstb = {{ ln="Foo"}, {c="Bar"}, {n=true, rc="Boo"}} local arsdef = {{ ln="Foo"}, {c="Bar"}, {rc="Boo"}, default=true} local arstr = [[LN Foo #Bar !RC Boo]] local defstr = [[* LN Foo #Bar RC Boo]] il = _G.advtrains.interlocking describe("ars_to_text", function () it("read table", function () assert.equals(il.ars_to_text(arstb),arstr) end) it("reads back and forth", function () assert.equals(il.ars_to_text(il.text_to_ars(arstr)),arstr) end) it("handles default routes properly", function () assert.equals(il.ars_to_text(arsdef),defstr) end) end) describe("text_to_ars", function () it("writes table", function() assert.same(il.text_to_ars(arstr),arstb) end) it("handles default routes properly", function () assert.same(il.text_to_ars(defstr),arsdef) end) end) train1 = {} train2 = {} train3 = {} train1.line = "Foo" train1.routingcode = "Boo" train2.line= "Bar" train2.routingcode = "NotBoo NotBoo" train3.routingcode = "Foo Boo Moo Zoo" describe("check_rule_match", function ()/* Minetest Copyright (C) 2010-2014 kwolekr, Ryan Kwolek <kwolekr@minetest.net> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "test.h" #include "mg_schematic.h" #include "gamedef.h" #include "nodedef.h" class TestSchematic : public TestBase { public: TestSchematic() { TestManager::registerTestModule(this); } const char *getName() { return "TestSchematic"; } void runTests(IGameDef *gamedef); void testMtsSerializeDeserialize(INodeDefManager *ndef); void testLuaTableSerialize(INodeDefManager *ndef