aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
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),