
Go to the source code of this file.
Functions | |
| abort_unless (head,"llist->head is NULL") | |
| abort_unless (llist->head,"llist->head is NULL") | |
| abort_unless (to_remove,"to_remove is NULL") | |
| abort_unless (element_next,"element_next is NULL") | |
| abort_unless (curlErrCode==1,"Curl_llist_insert_next returned an error, Can't move on with test") | |
| abort_unless (Curl_llist_count(llist)==1,"Number of list elements is not as expected, Aborting") | |
| abort_unless (Curl_llist_count(llist_destination)==0,"Number of list elements is not as expected, Aborting") | |
| abort_unless (curlErrCode==1,"Curl_llist_move returned an error, Can't move on with test") | |
| Curl_llist_insert_next (llist, llist->head,&unusedData_case3) | |
| Curl_llist_remove (llist, llist->head, NULL) | |
| Curl_llist_remove (llist, to_remove, NULL) | |
| fail_unless (llist->size==0,"list initial size should be zero") | |
| fail_unless (llist->head==NULL,"list head should initiate to NULL") | |
| fail_unless (llist->tail==NULL,"list tail should intiate to NULL") | |
| fail_unless (llist->dtor==test_curl_llist_dtor,"list dtor shold initiate to test_curl_llist_dtor") | |
| fail_unless (Curl_llist_count(llist)==(llist_size-1),"llist size not decremented as expected") | |
| fail_unless (llist->head==element_next,"llist new head not modified properly") | |
| fail_unless (llist->head->prev==NULL,"new head previous not set to null") | |
| fail_unless (element_prev->next==element_next,"element previous->next is not being adjusted") | |
| fail_unless (element_next->prev==element_prev,"element next->previous is not being adjusted") | |
| fail_unless (llist->tail==element_prev,"llist tail is not being adjusted when removing tail") | |
| fail_unless (llist->head==NULL,"llist head is not NULL while the llist is empty") | |
| fail_unless (llist->tail==NULL,"llist tail is not NULL while the llist is empty") | |
| fail_unless (Curl_llist_count(llist)==0,"moving element from llist didn't decrement the size") | |
| fail_unless (Curl_llist_count(llist_destination)==1,"moving element to llist_destination didn't increment the size") | |
| fail_unless (llist->head==NULL,"llist head not set to null after moving the head") | |
| fail_unless (llist_destination->head!=NULL,"llist_destination head set to null after moving an element") | |
| fail_unless (llist_destination->tail!=NULL,"llist_destination tail set to null after moving an element") | |
| fail_unless (llist_destination->tail==llist_destination->tail,"llist_destination tail doesn't equal llist_destination head") | |
| if (curlErrCode==1) | |
| else | printf ("skipping Curl_llist_insert_next as a non ""success error code was returned\n") |
| static void | test_curl_llist_dtor (void *key, void *value) |
| static CURLcode | unit_setup (void) |
| static void | unit_stop (void) |
Variables | |
| int | curlErrCode = 0 |
| struct curl_llist_element * | element_next = head->next |
| struct curl_llist_element * | element_prev = to_remove->prev |
| struct curl_llist_element * | head = llist->head |
| static struct curl_llist * | llist |
| static struct curl_llist * | llist_destination |
| size_t | llist_size = Curl_llist_count(llist) |
| struct curl_llist_element * | to_remove = llist->head->next |
| UNITTEST_START int | unusedData_case1 = 1 |
| int | unusedData_case2 = 2 |
| int | unusedData_case3 = 3 |
| abort_unless | ( | head | , |
| "llist->head is NULL" | |||
| ) |
| abort_unless | ( | llist-> | head, |
| "llist->head is NULL" | |||
| ) |
| abort_unless | ( | to_remove | , |
| "to_remove is NULL" | |||
| ) |
| abort_unless | ( | element_next | , |
| "element_next is NULL" | |||
| ) |
| abort_unless | ( | curlErrCode | = =1, |
| "Curl_llist_insert_next returned an | error, | ||
| Can't move on with test" | |||
| ) |
| abort_unless | ( | Curl_llist_count(llist) | = =1, |
| "Number of list elements is not as | expected, | ||
| Aborting" | |||
| ) |
| abort_unless | ( | Curl_llist_count(llist_destination) | = =0, |
| "Number of list elements is not as | expected, | ||
| Aborting" | |||
| ) |
| abort_unless | ( | curlErrCode | = =1, |
| "Curl_llist_move returned an | error, | ||
| Can't move on with test" | |||
| ) |
| Curl_llist_insert_next | ( | llist | , |
| llist-> | head, | ||
| & | unusedData_case3 | ||
| ) |
case 2: removing non head element, with list having >=2 elements : 1: insert another element to the list to make element >=2 : 1: list size will be decremented by one ; tested 2: element->previous->next will be element->next 3: element->next->previous will be element->previous
| Curl_llist_remove | ( | llist | , |
| llist-> | head, | ||
| NULL | |||
| ) |
| Curl_llist_remove | ( | llist | , |
| to_remove | , | ||
| NULL | |||
| ) |
| fail_unless | ( | llist-> | size = =0, |
| "list initial size should be zero" | |||
| ) |
testing llist_init case 1: list initiation : 1: list size will be 0 2: list head will be NULL 3: list tail will be NULL 4: list dtor will be NULL
| fail_unless | ( | llist-> | head = =NULL, |
| "list head should initiate to NULL" | |||
| ) |
| fail_unless | ( | llist-> | tail = =NULL, |
| "list tail should intiate to NULL" | |||
| ) |
| fail_unless | ( | llist-> | dtor = =test_curl_llist_dtor, |
| "list dtor shold initiate to test_curl_llist_dtor" | |||
| ) |
| fail_unless | ( | Curl_llist_count(llist) | = =(llist_size-1), |
| "llist size not decremented as expected" | |||
| ) |
| fail_unless | ( | llist-> | head = =element_next, |
| "llist new head not modified properly" | |||
| ) |
| fail_unless | ( | llist->head-> | prev = =NULL, |
| "new head previous not set to null" | |||
| ) |
| fail_unless | ( | element_prev-> | next = =element_next, |
| "element previous->next is not being adjusted" | |||
| ) |
| fail_unless | ( | element_next-> | prev = =element_prev, |
| "element next->previous is not being adjusted" | |||
| ) |
| fail_unless | ( | llist-> | tail = =element_prev, |
| "llist tail is not being adjusted when removing tail" | |||
| ) |
| fail_unless | ( | llist-> | head = =NULL, |
| "llist head is not NULL while the llist is empty" | |||
| ) |
| fail_unless | ( | llist-> | tail = =NULL, |
| "llist tail is not NULL while the llist is empty" | |||
| ) |
| fail_unless | ( | Curl_llist_count(llist) | = =0, |
| "moving element from llist didn't decrement the size" | |||
| ) |
| fail_unless | ( | Curl_llist_count(llist_destination) | = =1, |
| "moving element to llist_destination didn't increment the size" | |||
| ) |
| fail_unless | ( | llist-> | head = =NULL, |
| "llist head not set to null after moving the head" | |||
| ) |
| fail_unless | ( | llist_destination->head! | = NULL, |
| "llist_destination head set to null after moving an element" | |||
| ) |
| fail_unless | ( | llist_destination->tail! | = NULL, |
| "llist_destination tail set to null after moving an element" | |||
| ) |
| fail_unless | ( | llist_destination-> | tail = =llist_destination->tail, |
| "llist_destination tail doesn't equal llist_destination head" | |||
| ) |
| if | ( | curlErrCode | = = 1 | ) |
testing Curl_llist_insert_next case 2: list has 1 element, adding one element after the head : 1: the element next to head should be our newly created element 2: the list tail should be our newly created element
testing Curl_llist_insert_next case 3: list has >1 element, adding one element after "NULL" : 1: the element next to head should be our newly created element 2: the list tail should different from newly created element
Definition at line 96 of file unit1300.c.
| else printf | ( | "skipping Curl_llist_insert_next as a non ""success error code was returned\n" | ) |
| static void test_curl_llist_dtor | ( | void * | key, |
| void * | value | ||
| ) | [static] |
Definition at line 30 of file unit1300.c.
| static CURLcode unit_setup | ( | void | ) | [static] |
Definition at line 37 of file unit1300.c.
| static void unit_stop | ( | void | ) | [static] |
Definition at line 51 of file unit1300.c.
| curlErrCode = 0 |
testing Curl_llist_insert_next case 1: list is empty : 1: list size will be 1 2: list head will hold the data "unusedData_case1" 3: list tail will be the same as list head
1: moving head from an llist containg one element to an empty llist : 1: llist size will be 0 2: llist_destination size will be 1 3: llist head will be NULL 4: llist_destination head == llist_destination tail != NULL
Definition at line 66 of file unit1300.c.
| element_next = head->next |
Definition at line 62 of file unit1300.c.
| element_prev = to_remove->prev |
Definition at line 63 of file unit1300.c.
case 1: list has >1 element, removing head : 1: list size will be decremented by one 2: head will be the head->next 3: "new" head's previous will be NULL
Definition at line 61 of file unit1300.c.
struct curl_llist* llist [static] |
Definition at line 26 of file unit1300.c.
struct curl_llist* llist_destination [static] |
Definition at line 28 of file unit1300.c.
Definition at line 65 of file unit1300.c.
case 3: removing the tail with list having >=1 element 1: list size will be decremented by one ;tested 2: element->previous->next will be element->next ;tested 3: element->next->previous will be element->previous ;tested 4: list->tail will be tail->previous
case 4: removing head with list having 1 element : 1: list size will be decremented by one ;tested 2: list head will be null 3: list tail will be null
Definition at line 64 of file unit1300.c.
| UNITTEST_START int unusedData_case1 = 1 |
Definition at line 58 of file unit1300.c.
| int unusedData_case2 = 2 |
Definition at line 59 of file unit1300.c.
| int unusedData_case3 = 3 |
Definition at line 60 of file unit1300.c.