add test for races with "unarmed guard" flag.

This commit is contained in:
Enno Rehling 2016-10-26 11:48:52 +02:00
parent 654926fa06
commit 7c827c0389
1 changed files with 18 additions and 0 deletions

View File

@ -15,6 +15,23 @@
#include <CuTest.h>
#include "tests.h"
static void test_guard_unarmed(CuTest * tc)
{
unit *u, *ug;
region *r;
race *rc;
test_setup();
rc = test_create_race("mountainguard");
rc->flags |= RCF_UNARMEDGUARD;
r = test_create_region(0, 0, 0);
u = test_create_unit(test_create_faction(0), r);
ug = test_create_unit(test_create_faction(rc), r);
setguard(ug, GUARD_ALL);
CuAssertPtrEquals(tc, ug, is_guarded(r, u, GUARD_PRODUCE));
test_cleanup();
}
static void test_guard_monsters(CuTest * tc)
{
unit *u, *ug;
@ -32,6 +49,7 @@ static void test_guard_monsters(CuTest * tc)
CuSuite *get_guard_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_guard_unarmed);
SUITE_ADD_TEST(suite, test_guard_monsters);
return suite;
}