forked from github/server
make all tests use the new lua API
This commit is contained in:
parent
3f2e46c008
commit
619e84d0f7
|
@ -3,7 +3,7 @@ require "lunit"
|
||||||
module("tests.e3.castles", package.seeall, lunit.testcase )
|
module("tests.e3.castles", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
eressea.free_game()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_small_castles()
|
function test_small_castles()
|
||||||
|
|
|
@ -3,8 +3,8 @@ require "lunit"
|
||||||
module("tests.e3.e3features", package.seeall, lunit.testcase)
|
module("tests.e3.e3features", package.seeall, lunit.testcase)
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
eressea.free_game()
|
||||||
settings.set("rules.economy.food", "0")
|
eressea.settings.set("rules.economy.food", "0")
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_no_stealth()
|
function test_no_stealth()
|
||||||
|
@ -103,7 +103,7 @@ function test_xmastree()
|
||||||
local r
|
local r
|
||||||
r = use_tree("ocean")
|
r = use_tree("ocean")
|
||||||
assert_equal(0, r:get_resource("tree"))
|
assert_equal(0, r:get_resource("tree"))
|
||||||
free_game()
|
eressea.free_game()
|
||||||
r = use_tree("plain")
|
r = use_tree("plain")
|
||||||
assert_equal(10, r:get_resource("tree"))
|
assert_equal(10, r:get_resource("tree"))
|
||||||
end
|
end
|
||||||
|
@ -272,7 +272,7 @@ function test_market()
|
||||||
for i = 0, 5 do
|
for i = 0, 5 do
|
||||||
local rn = r:next(i)
|
local rn = r:next(i)
|
||||||
end
|
end
|
||||||
process.markets()
|
eressea.process.markets()
|
||||||
u:add_item("money", -u:get_item("money")) -- now we only have herbs
|
u:add_item("money", -u:get_item("money")) -- now we only have herbs
|
||||||
local len = 0
|
local len = 0
|
||||||
for i in u.items do
|
for i in u.items do
|
||||||
|
@ -415,7 +415,7 @@ function test_canoe_passes_through_land()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_give_50_percent_of_money()
|
function test_give_50_percent_of_money()
|
||||||
settings.set("rules.economy.food", "4")
|
eressea.settings.set("rules.economy.food", "4")
|
||||||
local r = region.create(0, 0, "plain")
|
local r = region.create(0, 0, "plain")
|
||||||
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
|
local u1 = unit.create(faction.create("noreply@eressea.de", "human", "de"), r, 1)
|
||||||
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
|
local u2 = unit.create(faction.create("noreply@eressea.de", "orc", "de"), r, 1)
|
||||||
|
|
|
@ -3,7 +3,7 @@ require "lunit"
|
||||||
module("tests.e3.morale", package.seeall, lunit.testcase )
|
module("tests.e3.morale", package.seeall, lunit.testcase )
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
eressea.free_game()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_when_owner_returns_morale_drops_only_2()
|
function test_when_owner_returns_morale_drops_only_2()
|
||||||
|
|
|
@ -6,8 +6,8 @@ local f
|
||||||
local u
|
local u
|
||||||
|
|
||||||
function setup()
|
function setup()
|
||||||
free_game()
|
eressea.free_game()
|
||||||
settings.set("rules.economy.food", "4")
|
eressea.settings.set("rules.economy.food", "4")
|
||||||
|
|
||||||
local r = region.create(0,0, "plain")
|
local r = region.create(0,0, "plain")
|
||||||
f = faction.create("stealthy@eressea.de", "human", "de")
|
f = faction.create("stealthy@eressea.de", "human", "de")
|
||||||
|
@ -19,7 +19,7 @@ function test_stealth_faction_on()
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("TARNEN PARTEI")
|
u:add_order("TARNEN PARTEI")
|
||||||
|
|
||||||
settings.set("rules.stealth.faction", 1)
|
eressea.settings.set("rules.stealth.faction", 1)
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_not_match("Partei", report.report_unit(u, f))
|
assert_not_match("Partei", report.report_unit(u, f))
|
||||||
assert_match("anonym", report.report_unit(u, f))
|
assert_match("anonym", report.report_unit(u, f))
|
||||||
|
@ -29,7 +29,7 @@ function test_stealth_faction_off()
|
||||||
u:clear_orders()
|
u:clear_orders()
|
||||||
u:add_order("TARNEN PARTEI")
|
u:add_order("TARNEN PARTEI")
|
||||||
|
|
||||||
settings.set("rules.stealth.faction", 0)
|
eressea.settings.set("rules.stealth.faction", 0)
|
||||||
process_orders()
|
process_orders()
|
||||||
assert_match("Partei", report.report_unit(u, f))
|
assert_match("Partei", report.report_unit(u, f))
|
||||||
assert_not_match("anonym", report.report_unit(u, f))
|
assert_not_match("anonym", report.report_unit(u, f))
|
||||||
|
|
Loading…
Reference in New Issue