2020-04-19 21:35:48 +02:00
|
|
|
local tcname = 'tests.e2.quit'
|
|
|
|
local lunit = require("lunit")
|
|
|
|
if _VERSION >= 'Lua 5.2' then
|
|
|
|
_ENV = module(tcname, 'seeall')
|
|
|
|
else
|
|
|
|
module(tcname, 'seeall')
|
|
|
|
end
|
2019-07-06 12:02:52 +02:00
|
|
|
|
|
|
|
function test_quit_faction()
|
2019-07-31 08:31:19 +02:00
|
|
|
local r = region.create(47, 0, "plain")
|
2019-07-06 12:02:52 +02:00
|
|
|
local f1 = faction.create("human")
|
|
|
|
f1.password = "steamedhams"
|
|
|
|
local f2 = faction.create("human")
|
2019-07-31 08:31:19 +02:00
|
|
|
local u1 = unit.create(f1, r, 8)
|
|
|
|
local u2 = unit.create(f2, r, 9)
|
2019-07-06 12:02:52 +02:00
|
|
|
local u3 = unit.create(f1, r, 10)
|
|
|
|
u1:clear_orders()
|
|
|
|
u2:clear_orders()
|
|
|
|
u1:add_order("STIRB steamedhams PARTEI " .. itoa36(f2.id))
|
|
|
|
u2:add_order("KONTAKTIERE " .. itoa36(u1.id))
|
|
|
|
process_orders()
|
|
|
|
assert_equal(f2, u1.faction)
|
|
|
|
assert_equal(f2, u2.faction)
|
|
|
|
assert_equal(f2, u3.faction)
|
|
|
|
end
|