forked from github/server
- moved test for bug 1738 to better location.
This commit is contained in:
parent
5b86fcb744
commit
33b68ecc19
|
@ -1427,35 +1427,3 @@ 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
|
||||
|
|
|
@ -658,3 +658,37 @@ function test_p2_move()
|
|||
assert_equal(1, u.region.x)
|
||||
assert_equal(1, r:get_resource("tree"))
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue