From 3b11067825ec2003d28dab6a5333234088b10ebd Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Mon, 1 May 2017 15:07:54 +0200 Subject: [PATCH] add a test for illusion buildings. --- src/magic.test.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/magic.test.c b/src/magic.test.c index 3f279315c..e2e695bbe 100644 --- a/src/magic.test.c +++ b/src/magic.test.c @@ -4,7 +4,7 @@ #include "teleport.h" #include "give.h" -#include +#include #include #include #include @@ -14,10 +14,12 @@ #include #include #include -#include + +#include #include #include +#include #include #include @@ -460,6 +462,27 @@ static void test_familiar_mage(CuTest *tc) { test_cleanup(); } +static void test_illusioncastle(CuTest *tc) +{ + building *b; + building_type *btype, *bt_icastle; + const attrib *a; + test_setup(); + btype = test_create_buildingtype("castle"); + bt_icastle = test_create_buildingtype("illusioncastle"); + b = test_create_building(test_create_region(0, 0, NULL), bt_icastle); + b->size = 1; + make_icastle(b, btype, 10); + a = a_find(b->attribs, &at_icastle); + CuAssertPtrNotNull(tc, a); + CuAssertPtrEquals(tc, btype, (void *)icastle_type(a)); + CuAssertPtrEquals(tc, bt_icastle, (void *)b->type); + CuAssertStrEquals(tc, "castle", buildingtype(btype, b, b->size)); + btype->construction->extra.name = strdup("site"); + CuAssertStrEquals(tc, "site", buildingtype(btype, b, b->size)); + test_cleanup(); +} + CuSuite *get_magic_suite(void) { CuSuite *suite = CuSuiteNew(); @@ -477,6 +500,7 @@ CuSuite *get_magic_suite(void) SUITE_ADD_TEST(suite, test_hasspell); SUITE_ADD_TEST(suite, test_magic_resistance); SUITE_ADD_TEST(suite, test_max_spellpoints); + SUITE_ADD_TEST(suite, test_illusioncastle); DISABLE_TEST(suite, test_familiar_mage); return suite; }