add a failing test for "monsters can guard when unarmed"

This commit is contained in:
Enno Rehling 2016-10-26 11:45:44 +02:00
parent 5bb2dbfd87
commit 654926fa06
3 changed files with 39 additions and 0 deletions

View File

@ -192,6 +192,7 @@ set(TESTS_SRC
donations.test.c
wormhole.test.c
alchemy.test.c
guard.test.c
test_eressea.c
tests.c
battle.test.c

37
src/guard.test.c Normal file
View File

@ -0,0 +1,37 @@
#include <platform.h>
#include "guard.h"
#include "monster.h"
#include <kernel/config.h>
#include <kernel/faction.h>
#include <kernel/unit.h>
#include <kernel/race.h>
#include <kernel/item.h>
#include <kernel/region.h>
#include <limits.h>
#include <CuTest.h>
#include "tests.h"
static void test_guard_monsters(CuTest * tc)
{
unit *u, *ug;
region *r;
test_setup();
r = test_create_region(0, 0, 0);
u = test_create_unit(test_create_faction(0), r);
ug = test_create_unit(get_monsters(), r);
setguard(ug, GUARD_ALL);
CuAssertPtrEquals(tc, ug, is_guarded(r, u, GUARD_PRODUCE));
test_cleanup();
}
CuSuite *get_guard_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_guard_monsters);
return suite;
}

View File

@ -111,6 +111,7 @@ int RunAllTests(int argc, char *argv[])
ADD_SUITE(ally);
ADD_SUITE(messages);
/* gamecode */
ADD_SUITE(guard);
ADD_SUITE(report);
ADD_SUITE(creport);
ADD_SUITE(prefix);