server/src/creport.test.c

57 lines
1.2 KiB
C
Raw Normal View History

2016-09-13 20:17:59 +02:00
#include <platform.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 <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;
}