forked from github/server
test lighthouse preparation
This commit is contained in:
parent
2b9e5ffff9
commit
42bfc43e4f
|
@ -2,6 +2,7 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include "reports.h"
|
#include "reports.h"
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
|
#include "lighthouse.h"
|
||||||
#include "travelthru.h"
|
#include "travelthru.h"
|
||||||
#include "keyword.h"
|
#include "keyword.h"
|
||||||
|
|
||||||
|
@ -222,6 +223,34 @@ static void test_arg_resources(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_prepare_lighthouse(CuTest *tc) {
|
||||||
|
report_context ctx;
|
||||||
|
faction *f;
|
||||||
|
region *r1, *r2, *r3;
|
||||||
|
unit *u;
|
||||||
|
building *b;
|
||||||
|
building_type *btype;
|
||||||
|
|
||||||
|
test_setup();
|
||||||
|
f = test_create_faction(0);
|
||||||
|
r1 = test_create_region(0, 0, 0);
|
||||||
|
r2 = test_create_region(1, 0, 0);
|
||||||
|
r3 = test_create_region(2, 0, 0);
|
||||||
|
btype = test_create_buildingtype("lighthouse");
|
||||||
|
b = test_create_building(r1, btype);
|
||||||
|
b->size = 10;
|
||||||
|
u = test_create_unit(f, r1);
|
||||||
|
u->building = b;
|
||||||
|
update_lighthouse(b);
|
||||||
|
prepare_report(&ctx, f);
|
||||||
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
|
CuAssertPtrEquals(tc, r3, ctx.last);
|
||||||
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
|
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
|
||||||
|
CuAssertIntEquals(tc, seen_none, r3->seen.mode);
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
static void test_prepare_report(CuTest *tc) {
|
static void test_prepare_report(CuTest *tc) {
|
||||||
report_context ctx;
|
report_context ctx;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
@ -260,6 +289,7 @@ CuSuite *get_reports_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
SUITE_ADD_TEST(suite, test_prepare_report);
|
SUITE_ADD_TEST(suite, test_prepare_report);
|
||||||
|
SUITE_ADD_TEST(suite, test_prepare_lighthouse);
|
||||||
SUITE_ADD_TEST(suite, test_reorder_units);
|
SUITE_ADD_TEST(suite, test_reorder_units);
|
||||||
SUITE_ADD_TEST(suite, test_seen_faction);
|
SUITE_ADD_TEST(suite, test_seen_faction);
|
||||||
SUITE_ADD_TEST(suite, test_regionid);
|
SUITE_ADD_TEST(suite, test_regionid);
|
||||||
|
|
Loading…
Reference in New Issue