server/scripts/tests/e3/stealth.lua

37 lines
887 B
Lua
Raw Normal View History

2010-08-29 02:54:15 +02:00
require "lunit"
2012-06-05 16:36:33 +02:00
module("tests.e3.stealth", package.seeall, lunit.testcase)
2010-08-29 02:54:15 +02:00
2012-06-05 16:36:33 +02:00
local f
local u
function setup()
eressea.game.reset()
eressea.settings.set("rules.food.flags", "4")
2012-06-05 16:36:33 +02:00
local r = region.create(0,0, "plain")
f = faction.create("stealth1@eressea.de", "human", "de")
u = unit.create(f, r, 1)
f = faction.create("stealth2@eressea.de", "human", "de")
2010-08-29 02:54:15 +02:00
end
function test_stealth_faction_on()
u:clear_orders()
u:add_order("TARNE PARTEI")
2010-08-29 02:54:15 +02:00
eressea.settings.set("rules.stealth.faction", 1)
2010-08-29 02:54:15 +02:00
process_orders()
assert_not_match("Partei", report.report_unit(u, f))
assert_match("anonym", report.report_unit(u, f))
end
function test_stealth_faction_off()
u:clear_orders()
u:add_order("TARNE PARTEI")
2010-08-29 02:54:15 +02:00
eressea.settings.set("rules.stealth.faction", 0)
2010-08-29 02:54:15 +02:00
process_orders()
assert_match("Partei", report.report_unit(u, f))
assert_not_match("anonym", report.report_unit(u, f))
end