Implement test_string_append

This commit is contained in:
Benedikt Heine 2017-09-25 03:54:37 +02:00
parent 4316c85e18
commit 8b11113be1

View File

@ -72,7 +72,29 @@ TEST test_string_replace(void)
TEST test_string_append(void) TEST test_string_append(void)
{ {
SKIP(); //TODO: Implement this char *exp;
ASSERT_STR_EQ("text_sep_bit", (exp = string_append(g_strdup("text"), "bit", "_sep_")));
g_free(exp);
ASSERT_STR_EQ("textbit", (exp = string_append(g_strdup("text"), "bit", NULL)));
g_free(exp);
ASSERT_STR_EQ("textbit", (exp = string_append(g_strdup("text"), "bit", "")));
g_free(exp);
ASSERT_STR_EQ("text", (exp = string_append(g_strdup("text"), "", NULL)));
g_free(exp);
ASSERT_STR_EQ("b", (exp = string_append(g_strdup(""), "b", NULL)));
g_free(exp);
ASSERT_STR_EQ("b", (exp = string_append(NULL, "b", "_sep_")));
g_free(exp);
ASSERT_STR_EQ("a", (exp = string_append(g_strdup("a"), "", NULL)));
g_free(exp);
ASSERT_EQ(NULL, (exp = string_append(NULL, NULL, "_sep_")));
g_free(exp);
PASS(); PASS();
} }