disable integration tests

combine prepare_ functions
This commit is contained in:
Enno Rehling 2016-09-14 17:14:04 +02:00
parent 576f183afb
commit 929db73102
3 changed files with 29 additions and 26 deletions

View file

@ -10,6 +10,12 @@ $BUILD/iniparser/inifile eressea.ini add lua:paths lunit:scripts
fi
}
integraton_tests() {
cd tests
./write-reports.sh
./run-turn.sh
}
set -e
[ -z $BUILD ] && BUILD=Debug ; export BUILD
s/cmake-init
@ -17,6 +23,5 @@ s/build
cd $ROOT
inifile
s/runtests
cd tests
./write-reports.sh
./run-turn.sh
# integraton_tests

View file

@ -23,19 +23,19 @@ local function assert_file(filename)
os.remove(filename)
end
function test_process_turn()
function disable_test_process_turn()
u:add_order("NUMMER PARTEI 777")
process_orders()
assert_equal(0, init_reports())
assert_equal(0, write_reports())
assert_equal(0, eressea.write_game("test.dat"))
assert_file("data/test.dat")
-- assert_file("reports/" .. get_turn() .. "-ii.nr")
-- assert_file("reports/" .. get_turn() .. "-ii.cr")
-- assert_file("reports/" .. get_turn() .. "-ii.txt")
-- assert_file("reports/" .. get_turn() .. "-777.nr")
-- assert_file("reports/" .. get_turn() .. "-777.cr")
-- assert_file("reports/" .. get_turn() .. "-777.txt")
assert_file("reports/" .. get_turn() .. "-ii.nr")
assert_file("reports/" .. get_turn() .. "-ii.cr")
assert_file("reports/" .. get_turn() .. "-ii.txt")
assert_file("reports/" .. get_turn() .. "-777.nr")
assert_file("reports/" .. get_turn() .. "-777.cr")
assert_file("reports/" .. get_turn() .. "-777.txt")
assert_file("reports/reports.txt")
os.remove("reports")
os.remove("data")

View file

@ -1388,26 +1388,29 @@ static void cb_add_seen(region *r, unit *u, void *cbdata) {
* this function may also update ctx->last and ctx->first for potential
* lighthouses and travelthru reports
*/
void prepare_seen(report_context *ctx)
static void prepare_report(report_context *ctx, faction *f)
{
faction *f = ctx->f;
region *r;
building *b;
static int config;
static bool rule_region_owners;
const struct building_type *bt_lighthouse = bt_find("lighthouse");
// [fast,last) interval of regions with a unit in it
ctx->first = firstregion(f);
ctx->last = lastregion(f);
if (config_changed(&config)) {
rule_region_owners = config_token("rules.region_owner_pay_building", bt_lighthouse->_name);
}
ctx->f = f;
ctx->report_time = time(NULL);
ctx->addresses = NULL;
ctx->userdata = NULL;
// [first,last) interval of regions with a unit in it:
ctx->first = firstregion(f);
ctx->last = lastregion(f);
for (r = ctx->first; r!=ctx->last; r = r->next) {
unit *u;
reorder_units(r);
if (fval(r, RF_LIGHTHOUSE)) {
/* region owners get the report from lighthouses */
if (rule_region_owners && bt_lighthouse) {
@ -1451,15 +1454,6 @@ void prepare_seen(report_context *ctx)
ctx->last = lastregion(f);
}
static void prepare_report(report_context *ctx, faction *f)
{
ctx->f = f;
ctx->report_time = time(NULL);
ctx->addresses = NULL;
ctx->userdata = NULL;
prepare_seen(ctx);
}
static void finish_reports(report_context *ctx) {
region *r;
ql_free(ctx->addresses);
@ -1549,8 +1543,12 @@ static void check_messages_exist(void) {
int init_reports(void)
{
region *r;
check_messages_exist();
create_directories();
for (r = regions; r; r = r->next) {
reorder_units(r);
}
return 0;
}