disable reports entirely.

This commit is contained in:
Enno Rehling 2016-09-13 20:17:59 +02:00
parent 4e4b4e482e
commit 482e619969
5 changed files with 66 additions and 32 deletions

View File

@ -102,7 +102,8 @@ set (ERESSEA_SRC
keyword.c
skill.c
json.c
creport.c
# creport.c
# report.c
economy.c
give.c
items.c
@ -114,7 +115,6 @@ set (ERESSEA_SRC
randenc.c
volcano.c
chaos.c
report.c
spy.c
study.c
summary.c
@ -195,7 +195,8 @@ set(TESTS_SRC
tests.test.c
volcano.test.c
reports.test.c
report.test.c
creport.test.c
# report.test.c
summary.test.c
travelthru.test.c
callback.test.c

View File

@ -1090,7 +1090,7 @@ int tolua_bindings_open(lua_State * L)
tolua_function(L, TOLUA_CAST "factions", tolua_get_factions);
tolua_function(L, TOLUA_CAST "regions", tolua_get_regions);
tolua_function(L, TOLUA_CAST "read_turn", tolua_read_turn);
tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map);
// tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map);
tolua_function(L, TOLUA_CAST "read_orders", tolua_read_orders);
tolua_function(L, TOLUA_CAST "process_orders", tolua_process_orders);
tolua_function(L, TOLUA_CAST "init_reports", tolua_init_reports);

58
src/creport.test.c Normal file
View File

@ -0,0 +1,58 @@
#include <platform.h>
#include <config.h>
#include "creport.h"
#include "move.h"
#include "travelthru.h"
#include "keyword.h"
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/ship.h>
#include <kernel/unit.h>
#include <kernel/spell.h>
#include <kernel/spellbook.h>
#include <util/language.h>
#include <util/lists.h>
#include <util/message.h>
#include <quicklist.h>
#include <stream.h>
#include <memstream.h>
#include <CuTest.h>
#include <tests.h>
#include <string.h>
static void test_cr_unit(CuTest *tc) {
stream strm;
char line[1024];
faction *f;
region *r;
unit *u;
test_cleanup();
f = test_create_faction(0);
r = test_create_region(0, 0, 0);
u = test_create_unit(f, r);
renumber_unit(u, 1234);
mstream_init(&strm);
cr_output_unit(&strm, r, f, u, seen_unit);
strm.api->rewind(strm.handle);
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
CuAssertStrEquals(tc, line, "EINHEIT 1234");
mstream_done(&strm);
test_cleanup();
}
CuSuite *get_creport_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_cr_unit);
return suite;
}

View File

@ -28,11 +28,10 @@
#include "calendar.h"
#include "chaos.h"
#include "creport.h"
#include "items.h"
#include "jsreport.h"
//#include "creport.h"
//#include "report.h"
#include "names.h"
#include "report.h"
#include "reports.h"
#include "spells.h"
#include "wormhole.h"
@ -66,7 +65,7 @@ void game_init(void)
register_xmas();
// register_nr();
register_cr();
// register_cr();
register_races();
register_spells();

View File

@ -1,7 +1,6 @@
#include <platform.h>
#include <config.h>
#include "reports.h"
#include "creport.h"
#include "move.h"
#include "travelthru.h"
#include "keyword.h"
@ -149,28 +148,6 @@ static void test_sparagraph(CuTest *tc) {
freestrlist(sp);
}
static void test_cr_unit(CuTest *tc) {
stream strm;
char line[1024];
faction *f;
region *r;
unit *u;
test_cleanup();
f = test_create_faction(0);
r = test_create_region(0, 0, 0);
u = test_create_unit(f, r);
renumber_unit(u, 1234);
mstream_init(&strm);
cr_output_unit(&strm, r, f, u, seen_unit);
strm.api->rewind(strm.handle);
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
CuAssertStrEquals(tc, line, "EINHEIT 1234");
mstream_done(&strm);
test_cleanup();
}
static void test_write_unit(CuTest *tc) {
unit *u;
faction *f;
@ -248,7 +225,6 @@ static void test_arg_resources(CuTest *tc) {
CuSuite *get_reports_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_cr_unit);
SUITE_ADD_TEST(suite, test_reorder_units);
SUITE_ADD_TEST(suite, test_seen_faction);
SUITE_ADD_TEST(suite, test_regionid);