forked from github/server
fix test of allies status after destroying a faction
This commit is contained in:
parent
50eba2d308
commit
04e2fb73c7
|
@ -16,18 +16,23 @@
|
|||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static void test_remove_empty_factions_allies(CuTest *tc) {
|
||||
static void test_destroyfaction_allies(CuTest *tc) {
|
||||
faction *f1, *f2;
|
||||
region *r;
|
||||
ally *al;
|
||||
|
||||
test_cleanup();
|
||||
r = test_create_region(0, 0, 0);
|
||||
f1 = test_create_faction(0);
|
||||
test_create_unit(f1, r);
|
||||
f2 = test_create_faction(0);
|
||||
ally_add(&f1->allies, f2);
|
||||
remove_empty_factions();
|
||||
CuAssertPtrEquals(tc, 0, f1->allies);
|
||||
al = ally_add(&f1->allies, f2);
|
||||
al->status = HELP_FIGHT;
|
||||
CuAssertIntEquals(tc, HELP_FIGHT, alliedgroup(0, f1, f2, f1->allies, HELP_ALL));
|
||||
CuAssertPtrEquals(tc, f2, f1->next);
|
||||
destroyfaction(&f1->next);
|
||||
CuAssertIntEquals(tc, false, faction_alive(f2));
|
||||
CuAssertIntEquals(tc, 0, alliedgroup(0, f1, f2, f1->allies, HELP_ALL));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
|
@ -174,7 +179,7 @@ CuSuite *get_faction_suite(void)
|
|||
CuSuite *suite = CuSuiteNew();
|
||||
SUITE_ADD_TEST(suite, test_addfaction);
|
||||
SUITE_ADD_TEST(suite, test_remove_empty_factions);
|
||||
SUITE_ADD_TEST(suite, test_remove_empty_factions_allies);
|
||||
SUITE_ADD_TEST(suite, test_destroyfaction_allies);
|
||||
SUITE_ADD_TEST(suite, test_remove_empty_factions_alliance);
|
||||
SUITE_ADD_TEST(suite, test_remove_dead_factions);
|
||||
SUITE_ADD_TEST(suite, test_get_monsters);
|
||||
|
|
Loading…
Reference in New Issue