From 02844171f9881b491565c91c4e69b518638e827a Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 23 Sep 2009 22:06:26 +0000 Subject: [PATCH] =?UTF-8?q?Neuer=20Testcase=20f=C3=BCr=20Wachen-halten-K?= =?UTF-8?q?=C3=A4mpfer-auf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/scripts/test-df.lua | 7 ------- src/scripts/tests.lua | 34 ++++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 9 deletions(-) delete mode 100644 src/scripts/test-df.lua diff --git a/src/scripts/test-df.lua b/src/scripts/test-df.lua deleted file mode 100644 index e2314124a..000000000 --- a/src/scripts/test-df.lua +++ /dev/null @@ -1,7 +0,0 @@ --- start eressea-server with -s file= --- where is relative to datapath() - -if read_game(file)~=0 then - print("could not read game") -end - diff --git a/src/scripts/tests.lua b/src/scripts/tests.lua index 1f558fa61..0a3090d45 100644 --- a/src/scripts/tests.lua +++ b/src/scripts/tests.lua @@ -270,6 +270,35 @@ local function test_recruit2() process_orders() end +local function test_guard() + free_game() + region.create(1, 0, "plain") + local r = region.create(0, 0, "plain") + local f1 = faction.create("noreply@eressea.de", "human", "de") + f1.age = 20 + local u1 = unit.create(f1, r, 1) + u1:add_item("sword", 10) + u1:set_skill("melee", 10) + u1:clear_orders() + u1:add_order("NACH O") + + local f2 = faction.create("noreply@eressea.de", "human", "de") + f2.age = 20 + local u2 = unit.create(f2, r, 1) + local u3 = unit.create(f2, r, 1) + local b = building.create(r, "castle") + b.size = 10 + u2.building = b + u3.building = b + update_owners() + u2:clear_orders() + u2:add_order("ATTACKIEREN " .. itoa36(u1.id)) -- you will die... + u2:add_item("money", 100) + u3:add_item("money", 100) + process_orders() + assert(u1.region==r) +end + local function test_owners() free_game() local r = region.create(0, 0, "plain") @@ -731,14 +760,15 @@ tests = { ["morale"] = test_morale, ["owners"] = test_owners, ["canoe"] = test_canoe, + ["guard"] = test_guard, ["market"] = test_market } mytests = { - ["canoe"] = test_canoe, + ["guard"] = test_guard, ["owners"] = test_owners } fail = 0 -for k, v in pairs(tests) do +for k, v in pairs(mytests) do local status, err = pcall(v) if not status then fail = fail + 1