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 <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
static void test_remove_empty_factions_allies(CuTest *tc) {
|
static void test_destroyfaction_allies(CuTest *tc) {
|
||||||
faction *f1, *f2;
|
faction *f1, *f2;
|
||||||
region *r;
|
region *r;
|
||||||
|
ally *al;
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
r = test_create_region(0, 0, 0);
|
r = test_create_region(0, 0, 0);
|
||||||
f1 = test_create_faction(0);
|
f1 = test_create_faction(0);
|
||||||
test_create_unit(f1, r);
|
test_create_unit(f1, r);
|
||||||
f2 = test_create_faction(0);
|
f2 = test_create_faction(0);
|
||||||
ally_add(&f1->allies, f2);
|
al = ally_add(&f1->allies, f2);
|
||||||
remove_empty_factions();
|
al->status = HELP_FIGHT;
|
||||||
CuAssertPtrEquals(tc, 0, f1->allies);
|
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();
|
test_cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +179,7 @@ CuSuite *get_faction_suite(void)
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
SUITE_ADD_TEST(suite, test_addfaction);
|
SUITE_ADD_TEST(suite, test_addfaction);
|
||||||
SUITE_ADD_TEST(suite, test_remove_empty_factions);
|
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_empty_factions_alliance);
|
||||||
SUITE_ADD_TEST(suite, test_remove_dead_factions);
|
SUITE_ADD_TEST(suite, test_remove_dead_factions);
|
||||||
SUITE_ADD_TEST(suite, test_get_monsters);
|
SUITE_ADD_TEST(suite, test_get_monsters);
|
||||||
|
|
Loading…
Reference in New Issue