2010-08-08 09:40:42 +02:00
|
|
|
require "lunit"
|
|
|
|
|
2012-06-05 16:36:33 +02:00
|
|
|
module("tests.e3.castles", package.seeall, lunit.testcase )
|
2010-08-08 09:40:42 +02:00
|
|
|
|
|
|
|
function setup()
|
2014-12-31 21:07:42 +01:00
|
|
|
eressea.game.reset()
|
2010-08-08 09:40:42 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function test_small_castles()
|
2014-12-31 21:07:42 +01:00
|
|
|
local r = region.create(0, 0, "plain")
|
|
|
|
local f1 = faction.create("noreply@eressea.de", "human", "de")
|
|
|
|
local u1 = unit.create(f1, r, 1)
|
|
|
|
local f2 = faction.create("noreply@eressea.de", "halfling", "de")
|
|
|
|
local u2 = unit.create(f2, r, 1)
|
|
|
|
u1:add_item("money", 10000)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
2014-12-31 21:07:42 +01:00
|
|
|
local b = building.create(r, "castle")
|
|
|
|
u2.building = b
|
|
|
|
u1.building = b
|
2010-08-08 09:40:42 +02:00
|
|
|
|
2014-12-31 21:07:42 +01:00
|
|
|
b.owner = u2
|
|
|
|
assert_equal("site", b:get_typename(7))
|
|
|
|
assert_equal("fortification", b:get_typename(8))
|
|
|
|
b.owner = u1
|
|
|
|
assert_equal("site", b:get_typename(9))
|
|
|
|
assert_equal("fortification", b:get_typename(10))
|
2010-08-08 09:40:42 +02:00
|
|
|
end
|