another test

This commit is contained in:
Enno Rehling 2009-12-13 20:15:49 +00:00
parent 25bf66e123
commit e95b9716af
1 changed files with 15 additions and 2 deletions

View File

@ -12,13 +12,16 @@ function test_capacity()
local r2 = region.create(2,0, "ocean") local r2 = region.create(2,0, "ocean")
local f = faction.create("noreply@eressea.de", "human", "de") local f = faction.create("noreply@eressea.de", "human", "de")
-- u1 is at the limit and moves
local s1 = ship.create(r, "cutter") local s1 = ship.create(r, "cutter")
local u1 = unit.create(f, r, 5) local u1 = unit.create(f, r, 5)
u1.ship = s1 u1.ship = s1
u1:set_skill("sailing", 10) u1:set_skill("sailing", 10)
u1:add_item("sword", 55)
u1:clear_orders() u1:clear_orders()
u1:add_order("NACH O O") u1:add_order("NACH O O")
-- u2 has too many people
local s2 = ship.create(r, "cutter") local s2 = ship.create(r, "cutter")
local u2 = unit.create(f, r, 6) local u2 = unit.create(f, r, 6)
u2.ship = s2 u2.ship = s2
@ -26,11 +29,21 @@ function test_capacity()
u2:clear_orders() u2:clear_orders()
u2:add_order("NACH O O") u2:add_order("NACH O O")
-- u4 has too much stuff
local s4 = ship.create(r, "cutter")
local u4 = unit.create(f, r, 5)
u4.ship = s4
u4:set_skill("sailing", 10)
u4:add_item("sword", 56)
u4:clear_orders()
u4:add_order("NACH O O")
update_owners() update_owners()
process_orders() process_orders()
-- print(s.region, u.region, r2) -- print(s.region, u.region, r2)
assert_equal(r2.id, u1.region.id) assert_equal(r2.id, u1.region.id)
assert_not_equal(r2.id, u2.region.id) assert_not_equal(r2.id, u2.region.id)
assert_not_equal(r2.id, u4.region.id)
end end
function test_owners() function test_owners()