From 8b11113be14a748391814a4e49756a6fae8dada8 Mon Sep 17 00:00:00 2001 From: Benedikt Heine Date: Mon, 25 Sep 2017 03:54:37 +0200 Subject: [PATCH] Implement test_string_append --- test/utils.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/test/utils.c b/test/utils.c index 84dc344..bccdd60 100644 --- a/test/utils.c +++ b/test/utils.c @@ -72,7 +72,29 @@ TEST test_string_replace(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(); }