- added test to reproduce bug 1738.

This commit is contained in:
Thomas Troeger 2014-03-16 20:43:26 +01:00 committed by Enno Rehling
parent a32e1cd127
commit 5b86fcb744
1 changed files with 32 additions and 0 deletions

View File

@ -1427,3 +1427,35 @@ function test_faction_flags()
f.flags = 42
assert_equal(42, f.flags)
end
function test_bug_1738_build_castle_e3()
local r = region.create(0, 0, "plain")
local f = faction.create("bug_1738@eressea.de", "human", "de")
local c = building.create(r, "castle")
c.size = 228
local u1 = unit.create(f, r, 1)
u1:set_skill("building", 5)
u1:add_item("stone", 10000)
local u2 = unit.create(f, r, 32)
u2:set_skill("building", 3)
u2:add_item("stone", 10000)
u1:clear_orders()
u1:add_order("MACHE BURG " .. itoa36(c.id))
-- castle now has size 229.
u2:clear_orders()
u2:add_order("MACHE BURG " .. itoa36(c.id))
-- 32 * 3 makes 96 talent points.
-- from size 229 to size 250 needs 21 * 3 = 63 points, rest 33.
-- 33/4 makes 8 points, resulting size is 258.
process_orders()
init_reports()
write_report(f)
-- resulting size should be 250 because unit 2
-- does not have the needed minimum talent.
assert_equal(c.size, 250)
end