From 9cf089b157ed0ad8619c7c108da2fba946bd4f27 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Fri, 12 Apr 2013 15:57:25 -0400 Subject: [PATCH] regressions/ck_list: Coverage for INSERT_AFTER/INSERT_BELOW. --- regressions/ck_queue/validate/ck_list.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/regressions/ck_queue/validate/ck_list.c b/regressions/ck_queue/validate/ck_list.c index 0c6c504..58aa291 100644 --- a/regressions/ck_queue/validate/ck_list.c +++ b/regressions/ck_queue/validate/ck_list.c @@ -167,6 +167,21 @@ main(int argc, char *argv[]) ck_error("List is not empty after bulk removal.\n"); } + CK_LIST_INSERT_HEAD(&head, &a, list_entry); + CK_LIST_INSERT_AFTER(&a, &b, list_entry); + + if (CK_LIST_NEXT(&b, list_entry) != NULL) + ck_error("Inserted item after last, it should not have no next.\n"); + + CK_LIST_INIT(&head); + + CK_LIST_INSERT_HEAD(&head, &a, list_entry); + CK_LIST_INSERT_BEFORE(&a, &b, list_entry); + + if (CK_LIST_NEXT(&b, list_entry) != &a) + ck_error("Inserted item before last, it should point to last.\n"); + + CK_LIST_INIT(&head); fprintf(stderr, "done (success)\n"); fprintf(stderr, "Beginning parallel traversal...");