aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-29 01:23:08 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2020-05-29 01:23:08 +0200
commitbec4fd31fd9f36dbcdad9d443a0c609adde1af67 (patch)
tree18fa9cb7675072dff4bf251da25444e8635880a1 /tests
parent050d32ae204b64f7098b12c77cdb92a33ebc7562 (diff)
downloadblogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.tar.gz
blogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.tar.bz2
blogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.zip
common: utils: added bc_slist_append_list
Diffstat (limited to 'tests')
-rw-r--r--tests/common/check_utils.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/common/check_utils.c b/tests/common/check_utils.c
index 471cd77..4efc1a5 100644
--- a/tests/common/check_utils.c
+++ b/tests/common/check_utils.c
@@ -54,6 +54,32 @@ test_slist_prepend(void **state)
static void
+test_slist_append_list(void **state)
+{
+ bc_slist_t *l = NULL;
+ assert_null(bc_slist_append_list(l, NULL));
+ l = bc_slist_append(l, (void*) bc_strdup("bola"));
+ l = bc_slist_append(l, (void*) bc_strdup("guda"));
+ bc_slist_t *t = bc_slist_append_list(l, NULL);
+ assert_true(l == t);
+ bc_slist_t *n = NULL;
+ n = bc_slist_append(n, (void*) bc_strdup("chunda"));
+ n = bc_slist_append(n, (void*) bc_strdup("asd"));
+ l = bc_slist_append_list(l, n);
+ assert_non_null(l);
+ assert_string_equal(l->data, "bola");
+ assert_non_null(l->next);
+ assert_string_equal(l->next->data, "guda");
+ assert_non_null(l->next->next);
+ assert_string_equal(l->next->next->data, "chunda");
+ assert_non_null(l->next->next->next);
+ assert_string_equal(l->next->next->next->data, "asd");
+ assert_null(l->next->next->next->next);
+ bc_slist_free_full(l, free);
+}
+
+
+static void
test_slist_free(void **state)
{
bc_slist_t *l = NULL;
@@ -1053,6 +1079,7 @@ main(void)
// slist
unit_test(test_slist_append),
unit_test(test_slist_prepend),
+ unit_test(test_slist_append_list),
unit_test(test_slist_free),
unit_test(test_slist_length),