2015-02-13 16:03:05 +01:00
|
|
|
require "lunit"
|
|
|
|
|
2014-08-07 13:19:19 +02:00
|
|
|
module ('tests.eressea.faction', package.seeall, lunit.testcase)
|
|
|
|
|
|
|
|
local f
|
|
|
|
|
|
|
|
function setup()
|
2015-02-20 20:35:02 +01:00
|
|
|
f = faction.create("faction@eressea.de", "human", "de")
|
2014-08-07 13:19:19 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function test_faction_flags()
|
2015-02-20 20:35:02 +01:00
|
|
|
assert_equal(0, f.flags)
|
|
|
|
f.flags = 42
|
|
|
|
assert_equal(42, f.flags)
|
2014-08-07 13:19:19 +02:00
|
|
|
end
|
2014-11-26 18:37:07 +01:00
|
|
|
|
|
|
|
function test_get_faction()
|
2015-02-20 20:35:02 +01:00
|
|
|
assert_equal(f, get_faction(f.id))
|
|
|
|
assert_equal(f, faction.get(f.id))
|
|
|
|
local nf = f.id
|
|
|
|
if nf>1 then nf = nf - 1 else nf = 1 end
|
|
|
|
assert_equal(nil, faction.get(nf))
|
2014-11-26 18:37:07 +01:00
|
|
|
end
|