add a test for giving horses to 0.

should add those horses to the region.
remove horses from test that is about 50% silver.
This commit is contained in:
Enno Rehling 2017-03-03 16:50:43 +01:00
parent 591a5b67d3
commit 259d7d9e80
3 changed files with 27 additions and 5 deletions

View File

@ -1028,3 +1028,16 @@ function test_recruit()
assert_equal(6, u.number)
end
end
function test_give_horses()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
r:set_resource("horse", 0)
u:add_item("horse", 20)
u:add_order("GIB 0 10 PFERDE")
process_orders()
assert_equal(10, r:get_resource("horse"))
assert_equal(10, u:get_item("horse"))
end

View File

@ -8,6 +8,19 @@ function setup()
eressea.settings.set("NewbieImmunity", "0")
end
function test_give_horses()
local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
r:set_resource("horse", 0)
u:add_item("charger", 20)
u:add_order("GIB 0 10 Streitross")
process_orders()
assert_equal(10, r:get_resource("horse"))
assert_equal(10, u:get_item("charger"))
end
function test_goblins()
local r = region.create(0, 0, "plain")
assert(r)

View File

@ -626,11 +626,7 @@ function test_give_50_percent_of_money()
u1:add_order("GIB " .. itoa36(u2.id) .. " 221 Silber")
u2:clear_orders()
u2:add_order("HELFEN " .. itoa36(u1.faction.id) .. " GIB")
u2:add_item("horse", 100)
u2:add_order("GIB 0 ALLES PFERD")
local h = r:get_resource("horse")
process_orders()
assert_true(r:get_resource("horse")>=h+100)
assert_equal(m1-221, u1:get_item("money"))
assert_equal(m2+110, u2:get_item("money"))
end
@ -990,4 +986,4 @@ function test_bug2187()
-- write_report(f)
set_rule("rules.food.flags", "4")
end
end