forked from github/server
separate test script for E4:
even though it has mostly the same rules, it does not have xmastrees, and loads a different config remove dead `inactivefaction` function, we have no use for the file it creates.
This commit is contained in:
parent
aa32cf190e
commit
42f1030251
|
@ -2,7 +2,7 @@
|
|||
"include": [
|
||||
"keywords.json",
|
||||
"prefixes.json",
|
||||
"e3/terrains.xml"
|
||||
"e3/terrains.json"
|
||||
],
|
||||
"settings": {
|
||||
"game.id": 4,
|
||||
|
|
|
@ -19,6 +19,7 @@ cd $ROOT
|
|||
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e2.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e3.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v0 scripts/run-tests-e4.lua
|
||||
rm -rf data reports orders.txt
|
||||
|
||||
cd $OLDWPD
|
||||
|
|
|
@ -15,6 +15,7 @@ require 'eressea'
|
|||
require 'eressea.xmlconf'
|
||||
require 'eressea.path'
|
||||
require 'tests.e2'
|
||||
require 'tests.xmas'
|
||||
require 'lunit'
|
||||
|
||||
rules = require('eressea.' .. config.rules)
|
||||
|
|
|
@ -15,6 +15,7 @@ require 'eressea'
|
|||
require 'eressea.path'
|
||||
require 'eressea.xmlconf'
|
||||
require 'tests.e3'
|
||||
require 'tests.xmas'
|
||||
require 'lunit'
|
||||
|
||||
eressea.settings.set("rules.alliances", "0")
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
-- Tests that work in E3. With game config of E3.
|
||||
-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua
|
||||
|
||||
path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
package.path = package.path .. ';' .. config.install .. '/lunit/?.lua'
|
||||
--needed to find lunit if not run form eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder)
|
||||
end
|
||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||
|
||||
config.rules = 'e4'
|
||||
|
||||
require 'eressea'
|
||||
require 'eressea.path'
|
||||
require 'eressea.xmlconf'
|
||||
require 'tests.e3'
|
||||
require 'lunit'
|
||||
|
||||
eressea.settings.set("rules.alliances", "0")
|
||||
rules = require('eressea.' .. config.rules)
|
||||
result = lunit.main()
|
||||
return result.errors + result.failed
|
|
@ -199,27 +199,6 @@ function test_seecast()
|
|||
assert_equal(8, u2.region.x)
|
||||
end
|
||||
|
||||
local function use_tree(terrain)
|
||||
local r = region.create(0,0, terrain)
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u1 = unit.create(f, r, 5)
|
||||
r:set_resource("tree", 0)
|
||||
u1:add_item("xmastree", 1)
|
||||
u1:clear_orders()
|
||||
u1:add_order("BENUTZEN 1 Weihnachtsbaum")
|
||||
process_orders()
|
||||
return r
|
||||
end
|
||||
|
||||
function test_xmastree()
|
||||
local r
|
||||
r = use_tree("ocean")
|
||||
assert_equal(0, r:get_resource("tree"))
|
||||
eressea.free_game()
|
||||
r = use_tree("plain")
|
||||
assert_equal(10, r:get_resource("tree"))
|
||||
end
|
||||
|
||||
function test_fishing()
|
||||
eressea.settings.set("rules.food.flags", "0")
|
||||
local r = region.create(0,0, "ocean")
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
local function use_tree(terrain)
|
||||
local r = region.create(0,0, terrain)
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u1 = unit.create(f, r, 5)
|
||||
r:set_resource("tree", 0)
|
||||
u1:add_item("xmastree", 1)
|
||||
u1:clear_orders()
|
||||
u1:add_order("BENUTZEN 1 Weihnachtsbaum")
|
||||
process_orders()
|
||||
return r
|
||||
end
|
||||
|
||||
function test_xmastree()
|
||||
local r
|
||||
r = use_tree("ocean")
|
||||
assert_equal(0, r:get_resource("tree"))
|
||||
eressea.free_game()
|
||||
r = use_tree("plain")
|
||||
assert_equal(10, r:get_resource("tree"))
|
||||
end
|
23
src/laws.c
23
src/laws.c
|
@ -861,24 +861,6 @@ static int modify(int i)
|
|||
}
|
||||
}
|
||||
|
||||
static void inactivefaction(faction * f)
|
||||
{
|
||||
FILE *inactiveFILE;
|
||||
char zText[128];
|
||||
|
||||
sprintf(zText, "%s/%s", datapath(), "inactive");
|
||||
inactiveFILE = fopen(zText, "a");
|
||||
|
||||
if (inactiveFILE) {
|
||||
fprintf(inactiveFILE, "%s:%s:%d:%d\n",
|
||||
factionid(f),
|
||||
LOC(default_locale, rc_name_s(f->race, NAME_PLURAL)),
|
||||
modify(count_all(f)), turn - f->lastorders);
|
||||
|
||||
fclose(inactiveFILE);
|
||||
}
|
||||
}
|
||||
|
||||
/* test if the unit can slip through a siege undetected.
|
||||
* returns 0 if siege is successful, or 1 if the building is either
|
||||
* not besieged or the unit can slip through the siege due to better stealth.
|
||||
|
@ -1279,11 +1261,6 @@ static void remove_idle_players(void)
|
|||
sprintf(info, "%d Einheiten, %d Personen, %d Silber",
|
||||
f->no_units, f->num_total, f->money);
|
||||
}
|
||||
|
||||
if (NMRTimeout() > 0 && turn - f->lastorders >= (NMRTimeout() - 1)) {
|
||||
inactivefaction(f);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
log_info(" - beseitige Spieler, die sich nach der Anmeldung nicht gemeldet haben...");
|
||||
|
||||
|
|
|
@ -5,5 +5,6 @@ SET SERVER=%BUILD%\eressea.exe
|
|||
%SERVER% ..\scripts\run-tests.lua
|
||||
%SERVER% ..\scripts\run-tests-e2.lua
|
||||
%SERVER% ..\scripts\run-tests-e3.lua
|
||||
%SERVER% ..\scripts\run-tests-e4.lua
|
||||
PAUSE
|
||||
RMDIR /s /q reports
|
||||
|
|
Loading…
Reference in New Issue