server/src/kernel/ally.test.c

29 lines
578 B
C
Raw Normal View History

#include <platform.h>
#include "types.h"
#include "ally.h"
#include <CuTest.h>
#include <tests.h>
static void test_ally(CuTest * tc)
{
2018-10-26 19:47:50 +02:00
ally * al = NULL;
struct faction * f1 = test_create_faction(NULL);
2018-10-26 19:47:50 +02:00
ally_set(&al, f1, HELP_GUARD);
CuAssertPtrNotNull(tc, al);
2018-10-26 19:47:50 +02:00
CuAssertIntEquals(tc, HELP_GUARD, ally_get(al, f1));
2018-10-26 19:47:50 +02:00
ally_set(&al, f1, 0);
2018-10-14 11:48:21 +02:00
CuAssertPtrEquals(tc, NULL, al);
2018-10-26 19:47:50 +02:00
CuAssertIntEquals(tc, 0, ally_get(al, f1));
}
CuSuite *get_ally_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_ally);
return suite;
}