simple test for basic unit descriptions

This commit is contained in:
Enno Rehling 2016-09-02 09:29:52 +02:00
parent 02374cd492
commit b725e9676a
1 changed files with 15 additions and 0 deletions

View File

@ -387,10 +387,25 @@ static void test_limited_skills(CuTest *tc) {
test_cleanup(); test_cleanup();
} }
static void test_unit_description(CuTest *tc) {
race *rc;
unit *u;
test_setup();
rc = test_create_race("hodor");
u = test_create_unit(test_create_faction(rc), test_create_region(0,0,0));
CuAssertPtrEquals(tc, 0, u->display);
CuAssertStrEquals(tc, 0, u_description(u, u->faction->locale));
u->display = _strdup("Hodor");
CuAssertStrEquals(tc, "Hodor", u_description(u, NULL));
CuAssertStrEquals(tc, "Hodor", u_description(u, u->faction->locale));
test_cleanup();
}
CuSuite *get_unit_suite(void) CuSuite *get_unit_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_scale_number); SUITE_ADD_TEST(suite, test_scale_number);
SUITE_ADD_TEST(suite, test_unit_description);
SUITE_ADD_TEST(suite, test_unit_name); SUITE_ADD_TEST(suite, test_unit_name);
SUITE_ADD_TEST(suite, test_unit_name_from_race); SUITE_ADD_TEST(suite, test_unit_name_from_race);
SUITE_ADD_TEST(suite, test_update_monster_name); SUITE_ADD_TEST(suite, test_update_monster_name);