2020-04-22 03:03:44 +02:00
|
|
|
local tcname = 'tests.e3.stealth'
|
|
|
|
local lunit = require("lunit")
|
|
|
|
if _VERSION >= 'Lua 5.2' then
|
|
|
|
_ENV = module(tcname, 'seeall')
|
|
|
|
else
|
|
|
|
module(tcname, 'seeall')
|
|
|
|
end
|
2010-08-29 02:54:15 +02:00
|
|
|
|
2012-06-05 16:36:33 +02:00
|
|
|
local f
|
|
|
|
local u
|
|
|
|
|
|
|
|
function setup()
|
2015-11-09 14:06:55 +01:00
|
|
|
eressea.game.reset()
|
|
|
|
eressea.settings.set("rules.food.flags", "4")
|
2012-06-05 16:36:33 +02:00
|
|
|
|
2015-11-09 14:06:55 +01:00
|
|
|
local r = region.create(0,0, "plain")
|
2017-03-17 22:31:59 +01:00
|
|
|
f = faction.create("human", "stealth1@eressea.de", "de")
|
2015-11-09 14:06:55 +01:00
|
|
|
u = unit.create(f, r, 1)
|
2017-03-17 22:31:59 +01:00
|
|
|
f = faction.create("human", "stealth2@eressea.de", "de")
|
2010-08-29 02:54:15 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function test_stealth_faction_on()
|
2015-11-09 14:06:55 +01:00
|
|
|
u:clear_orders()
|
|
|
|
u:add_order("TARNE PARTEI")
|
2010-08-29 02:54:15 +02:00
|
|
|
|
2015-11-09 14:06:55 +01:00
|
|
|
process_orders()
|
|
|
|
assert_not_match("Partei", report.report_unit(u, f))
|
|
|
|
assert_match("anonym", report.report_unit(u, f))
|
2010-08-29 02:54:15 +02:00
|
|
|
end
|
|
|
|
|
2015-11-09 14:06:55 +01:00
|
|
|
function test_stealth_faction_other()
|
|
|
|
u:clear_orders()
|
|
|
|
u:add_order("TARNE PARTEI " .. itoa36(f.id))
|
2010-08-29 02:54:15 +02:00
|
|
|
|
2015-11-09 14:06:55 +01:00
|
|
|
process_orders()
|
|
|
|
assert_not_match("anonym", report.report_unit(u, f))
|
|
|
|
assert_not_match(itoa36(f.id), report.report_unit(u, f))
|
2010-08-29 02:54:15 +02:00
|
|
|
end
|