From 45d16ef18fe4f343e3bf76406697243236973f12 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 9 Apr 2016 11:52:26 +0200 Subject: [PATCH] test: ALLIANCE transfer leadership --- src/kernel/alliance.test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/kernel/alliance.test.c b/src/kernel/alliance.test.c index c85e487fa..8432f1692 100644 --- a/src/kernel/alliance.test.c +++ b/src/kernel/alliance.test.c @@ -175,6 +175,25 @@ static void test_alliance_cmd_leave(CuTest *tc) { test_cleanup(); } +static void test_alliance_cmd_transfer(CuTest *tc) { + unit *u1, *u2; + struct region *r; + struct alliance *al; + + test_cleanup(); + al = makealliance(42, "Hodor"); + r = test_create_region(0, 0, 0); + u1 = test_create_unit(test_create_faction(0), r); + u2 = test_create_unit(test_create_faction(0), r); + setalliance(u1->faction, al); + setalliance(u2->faction, al); + CuAssertPtrEquals(tc, u1->faction, alliance_get_leader(al)); + unit_addorder(u1, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_TRANSFER], itoa36(u2->faction->no))); + alliance_cmd(); + CuAssertPtrEquals(tc, u2->faction, alliance_get_leader(al)); + test_cleanup(); +} + CuSuite *get_alliance_suite(void) { @@ -186,6 +205,7 @@ CuSuite *get_alliance_suite(void) SUITE_ADD_TEST(suite, test_alliance_cmd_no_invite); SUITE_ADD_TEST(suite, test_alliance_cmd_kick); SUITE_ADD_TEST(suite, test_alliance_cmd_leave); + SUITE_ADD_TEST(suite, test_alliance_cmd_transfer); return suite; }