functional test of the new packice terrain

This commit is contained in:
Enno Rehling 2010-09-11 20:46:46 -07:00
parent 22ab8ae620
commit cfa66a87c7

View file

@ -565,43 +565,65 @@ function test_market_action()
assert_equal(70, u:get_item("h2")) assert_equal(70, u:get_item("h2"))
end end
-- function test_process_execute() local function setup_packice(x, onfoot)
-- local i = 0 local f = faction.create("noreply@eressea.de", "human", "de")
-- local f = faction.create("noreply@eressea.de", "human", "de") local plain = region.create(0,0, "plain")
-- local r = region.create(0, 0, "plain") local ice = region.create(1,0, "packice")
-- local u = unit.create(f, r, 1) local ocean = region.create(2,0, "ocean")
-- local r1, u1 local u = unit.create(f, get_region(x, 0), 2)
if not onfoot then
local s = ship.create(u.region, "cutter")
u:set_skill("sailing", 3)
u.ship = s
end
u:add_item("money", 400)
-- function a() i = 2 end return u
-- function b() i = i * 2 end end
-- function c(r) r1 = r i = i + 1 end
-- function d(u) u1 = u i = i * 3 end
-- process.execute({a, b}, {c}, {d})
-- assert_equal(15, i)
-- assert_equal(r, r1)
-- assert_equal(u, u1)
-- end
-- function test_new_orders() function test_no_sailing_through_packice()
-- local i = 0 local u = setup_packice(0)
-- local f = faction.create("noreply@eressea.de", "human", "de") u:clear_orders()
-- local r = region.create(0, 0, "plain") u:add_order("NACH O O")
-- local u = unit.create(f, r, 1) process_orders()
-- local r1, u1 assert_equal(0, u.region.x)
end
-- function a() i = 2 end function test_can_sail_from_packice_to_ocean()
-- function b() i = i * 2 end local u = setup_packice(1)
-- function c(r) r1 = r i = i + 1 end
-- function d(u) u1 = u i = i * 3 end
-- process.setup() u:clear_orders()
-- process.push(a) u:add_order("NACH W")
-- process.push(b) process_orders()
-- process.push(c, "region") assert_equal(1, u.region.x)
-- process.push(d, "unit")
-- process.start() u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(2, u.region.x)
end
function test_can_sail_into_packice()
local u = setup_packice(2)
u:clear_orders()
u:add_order("NACH W W")
process_orders()
assert_equal(1, u.region.x)
end
function test_can_walk_into_packice()
local u = setup_packice(0, true)
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(1, u.region.x)
end
function test_cannot_walk_into_ocean()
local u = setup_packice(1, true)
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_equal(1, u.region.x)
end
-- assert_equal(15, i)
-- assert_equal(r, r1)
-- assert_equal(u, u1)
-- end