From e149d444c174e6cbe07e5275b6adaba7fc30c187 Mon Sep 17 00:00:00 2001 From: TurnerSE Date: Sat, 31 Oct 2015 04:10:08 +0100 Subject: [PATCH] expanded existing skillpotion-test to test for existence of description --- src/items/xerewards.test.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/items/xerewards.test.c b/src/items/xerewards.test.c index 5ce7716f3..ddaab85f3 100644 --- a/src/items/xerewards.test.c +++ b/src/items/xerewards.test.c @@ -2,11 +2,16 @@ #include "xerewards.h" +#include #include #include #include #include +#include + +#include + #include #include @@ -18,14 +23,29 @@ static void test_manacrystal(CuTest *tc) { static void test_skillpotion(CuTest *tc) { unit *u; + faction *f; const struct item_type *itype; + const char* pPotionText = NULL; + const char* pDescription = NULL; test_cleanup(); test_create_world(); - u = test_create_unit(test_create_faction(NULL), findregion(0, 0)); + + f = test_create_faction(NULL); + u = test_create_unit(f, findregion(0, 0)); itype = test_create_itemtype("skillpotion"); change_resource(u, itype->rtype, 2); CuAssertIntEquals(tc, 1, use_skillpotion(u, itype, 1, NULL)); + + pPotionText = mkname("potion", "skillpotion"); + CuAssertPtrNotNull(tc, pPotionText); + + pDescription = LOC(f->locale, pPotionText); + CuAssertPtrNotNull(tc, pDescription); + + CuAssert(tc, "Description empty", strlen(pDescription) == 0); + + test_cleanup(); }