fix tests that relied on translation structures being statically cached.

clean up static cache, add test for German imperative (WIP)
This commit is contained in:
Enno Rehling 2014-10-23 16:14:01 +02:00
parent 96d5544b1f
commit f788f19f6c
4 changed files with 17 additions and 3 deletions

View File

@ -32,6 +32,7 @@ static void test_parse_order(CuTest *tc) {
struct locale * lang = get_or_create_locale("en");
locale_setstring(lang, "keyword::move", "MOVE");
init_keyword(lang, K_MOVE, "MOVE");
ord = parse_order("MOVE NORTH", lang);
CuAssertPtrNotNull(tc, ord);
CuAssertIntEquals(tc, K_MOVE, getkeyword(ord));

View File

@ -19,6 +19,18 @@ static void test_init_keywords(CuTest *tc) {
test_cleanup();
}
static void test_infinitive(CuTest *tc) {
struct locale *lang;
test_cleanup();
lang = get_or_create_locale("de");
init_keyword(lang, K_STUDY, "LERNEN");
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERN", lang));
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNE", lang));
CuAssertIntEquals(tc, K_STUDY, get_keyword("LERNEN", lang));
test_cleanup();
}
static void test_init_keyword(CuTest *tc) {
struct locale *lang;
test_cleanup();
@ -76,6 +88,7 @@ static void test_get_shortest_match(CuTest *tc) {
CuSuite *get_keyword_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_infinitive);
SUITE_ADD_TEST(suite, test_init_keyword);
SUITE_ADD_TEST(suite, test_init_keywords);
SUITE_ADD_TEST(suite, test_findkeyword);
@ -83,4 +96,3 @@ CuSuite *get_keyword_suite(void)
SUITE_DISABLE_TEST(suite, test_get_keyword_default);
return suite;
}

View File

@ -11,8 +11,8 @@ static void test_init_skills(CuTest *tc) {
test_cleanup();
lang = get_or_create_locale("de");
locale_setstring(lang, "alchemy", "Alchemie");
init_skills(lang);
// locale_setstring(lang, "alchemy", "Alchemie");
init_skill(lang, SK_ALCHEMY, "Alchemie");
CuAssertIntEquals(tc, SK_ALCHEMY, get_skill("alchemie", lang));
test_cleanup();
}

View File

@ -261,4 +261,5 @@ void free_locales(void)
free(locales);
locales = next;
}
memset(lstrs, 0, sizeof(lstrs)); // TODO: does this data need to be free'd?
}