From 4e1a1248018ea8f852524fad5adecbe2aede0e19 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 28 Mar 2021 19:07:42 +0200 Subject: [PATCH] https://bugs.eressea.de/view.php?id=2734 additional testing for GIVE UNIT --- src/give.test.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/give.test.c b/src/give.test.c index 0bef3d289..cc356ce01 100644 --- a/src/give.test.c +++ b/src/give.test.c @@ -111,6 +111,17 @@ static void test_give_unit(CuTest * tc) { CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "give_person")); CuAssertPtrNotNull(tc, test_find_messagetype(env.f2->msgs, "receive_person")); + /* must be allied to transfer a unit */ + u_setfaction(env.src, env.f1); + ally_set(&env.f2->allies, env.f1, 0); + give_unit(env.src, env.dst, NULL); + CuAssertPtrEquals(tc, env.f1, env.src->faction); + + /* contact also works */ + contact_unit(env.dst, env.src); + give_unit(env.src, env.dst, NULL); + CuAssertPtrEquals(tc, env.f2, env.src->faction); + test_teardown(); }