From 4717bae6222f8e62d4a5ecabd52531c947d5bfff Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 18 Jan 2010 06:11:46 +0000 Subject: [PATCH] test for building other people's buildings --- src/scripts/tests/common.lua | 22 +++++++++++++++++++++- src/scripts/tests/e3a.lua | 1 - 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/scripts/tests/common.lua b/src/scripts/tests/common.lua index f24494026..b5540c6c5 100644 --- a/src/scripts/tests/common.lua +++ b/src/scripts/tests/common.lua @@ -40,7 +40,6 @@ function test_fleeing_units_can_be_transported() u3:add_item("horse", u2.number) u3:add_order("KAEMPFE FLIEHE") process_orders() - write_reports() assert_equal(u3.region.id, r1.id, "transporter did not move") assert_equal(u2.region.id, r1.id, "transported unit did not move") end @@ -546,3 +545,24 @@ function test_storage() assert(u) assert(u:get_item("money") == u.number * 100) end + +function test_building_other() + local r = region.create(0,0, "plain") + local f1 = faction.create("noreply@eressea.de", "human", "de") + local f2 = faction.create("noreply@eressea.de", "human", "de") + local b = building.create(r, "castle") + b.size = 10 + local u1 = unit.create(f1, r, 3) + u1.building = b + u1:add_item("money", 100) + + local u2 = unit.create(f2, r, 3) + u2:set_skill("building", 10) + u2:add_item("money", 100) + u2:add_item("stone", 100) + u2:clear_orders() + u2:add_order("MACHEN BURG " .. itoa36(b.id)) + update_owners() + process_orders() + assert_not_equal(10, b.size) +end diff --git a/src/scripts/tests/e3a.lua b/src/scripts/tests/e3a.lua index 8b7fadec4..febae24d2 100644 --- a/src/scripts/tests/e3a.lua +++ b/src/scripts/tests/e3a.lua @@ -372,7 +372,6 @@ function test_canoe_passes_through_land() assert_equal(u2.region.id, land.id, "canoe did not stop at coast") u1:add_order("NACH O O O") process_orders() - write_reports() assert_equal(u2.region.id, dst.id, "canoe could not leave coast") end