Go to the source code of this file.
Functions | |
abort_unless (Curl_llist_count(&llist)==1, "Number of list elements is not as expected, Aborting") | |
abort_unless (element_next, "element_next is NULL") | |
abort_unless (head, "llist.head is NULL") | |
abort_unless (llist.head, "llist.head is NULL") | |
abort_unless (to_remove, "to_remove is NULL") | |
fail_unless (Curl_llist_count(&llist)==(llist_size-1), "llist size not decremented as expected") | |
fail_unless (Curl_llist_count(&llist)==0, "moving element from llist didn't decrement the size") | |
fail_unless (Curl_llist_count(&llist)==1, "List size should be 1 after adding a new element") | |
fail_unless (Curl_llist_count(&llist_destination)==1, "moving element to llist_destination didn't increment the size") | |
fail_unless (element_next->prev==element_prev, "element next->previous is not being adjusted") | |
fail_unless (element_prev->next==element_next, "element previous->next is not being adjusted") | |
fail_unless (llist.dtor==test_curl_llist_dtor, "list dtor shold initiate to test_curl_llist_dtor") | |
fail_unless (llist.head->next->ptr==&unusedData_case3, "the node next to head is not getting set correctly") | |
fail_unless (llist.head->prev==NULL, "new head previous not set to null") | |
fail_unless (llist.head->ptr==&unusedData_case1, "head ptr should be first entry") | |
fail_unless (llist.head==element_next, "llist new head not modified properly") | |
fail_unless (llist.head==NULL, "list head should initiate to NULL") | |
fail_unless (llist.head==NULL, "llist head is not NULL while the llist is empty") | |
fail_unless (llist.head==NULL, "llist head not set to null after moving the head") | |
fail_unless (llist.size==0, "list initial size should be zero") | |
testing llist_init case 1: list initiation @assumptions: 1: list size will be 0 2: list head will be NULL 3: list tail will be NULL 4: list dtor will be NULL More... | |
fail_unless (llist.tail->ptr !=&unusedData_case2, "the list tail is not getting set correctly") | |
fail_unless (llist.tail->ptr==&unusedData_case3, "the list tail is not getting set correctly") | |
fail_unless (llist.tail==element_prev, "llist tail is not being adjusted when removing tail") | |
fail_unless (llist.tail==llist.head, "tail and head should be the same") | |
fail_unless (llist.tail==NULL, "list tail should intiate to NULL") | |
fail_unless (llist.tail==NULL, "llist tail is not NULL while the llist is empty") | |
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") | |
fail_unless (llist_size==3, "should be 3 list members") | |
static void | test_curl_llist_dtor (void *key, void *value) |
static CURLcode | unit_setup (void) |
static void | unit_stop (void) |
Variables | |
struct curl_llist_element | case1_list |
struct curl_llist_element | case2_list |
struct curl_llist_element | case3_list |
struct curl_llist_element | case4_list |
struct curl_llist_element | case5_list |
struct curl_llist_element * | element_next = head->next |
struct curl_llist_element * | element_prev = to_remove->prev |
struct curl_llist_element * | head = llist.head |
case 1: list has >1 element, removing head @assumptions: 1: list size will be decremented by one 2: head will be the head->next 3: "new" head's previous will be NULL More... | |
static struct curl_llist | llist |
testing Curl_llist_insert_next case 1: list is empty @assumptions: 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 More... | |
static struct curl_llist | llist_destination |
size_t | llist_size = Curl_llist_count(&llist) |
struct curl_llist_element * | to_remove = llist.head->next |
case 3: removing the tail with list having >=1 element @assumptions 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 More... | |
UNITTEST_START | |
int | unusedData_case2 = 2 |
int | unusedData_case3 = 3 |
abort_unless | ( | Curl_llist_count & | llist = =1 , |
"Number of list elements is not as | expected, | ||
Aborting" | |||
) |
abort_unless | ( | element_next | , |
"element_next is NULL" | |||
) |
abort_unless | ( | head | , |
"llist.head is NULL" | |||
) |
abort_unless | ( | llist. | head, |
"llist.head is NULL" | |||
) |
abort_unless | ( | to_remove | , |
"to_remove is NULL" | |||
) |
fail_unless | ( | Curl_llist_count & | llist = =(llist_size-1) , |
"llist size not decremented as expected" | |||
) |
fail_unless | ( | Curl_llist_count & | llist = =0 , |
"moving element from llist didn't decrement the size" | |||
) |
fail_unless | ( | Curl_llist_count & | llist = =1 , |
"List size should be 1 after adding a new element" | |||
) |
fail_unless | ( | Curl_llist_count & | llist_destination = =1 , |
"moving element to llist_destination didn't increment the size" | |||
) |
fail_unless | ( | element_next-> | prev = =element_prev , |
"element next->previous is not being adjusted" | |||
) |
fail_unless | ( | element_prev-> | next = =element_next , |
"element previous->next is not being adjusted" | |||
) |
fail_unless | ( | llist. | dtor = =test_curl_llist_dtor , |
"list dtor shold initiate to test_curl_llist_dtor" | |||
) |
fail_unless | ( | llist.head->next-> | ptr = =&unusedData_case3 , |
"the node next to head is not getting set correctly" | |||
) |
fail_unless | ( | llist.head-> | prev = =NULL , |
"new head previous not set to null" | |||
) |
fail_unless | ( | llist.head-> | ptr = =&unusedData_case1 , |
"head ptr should be first entry" | |||
) |
fail_unless | ( | llist. | head = =element_next , |
"llist new head not modified properly" | |||
) |
fail_unless | ( | llist. | head = =NULL , |
"list head should initiate to NULL" | |||
) |
testing llist_init case 1: list initiation @assumptions: 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.tail->ptr ! | = &unusedData_case2 , |
"the list tail is not getting set correctly" | |||
) |
fail_unless | ( | llist.tail-> | ptr = =&unusedData_case3 , |
"the list tail is not getting set correctly" | |||
) |
fail_unless | ( | llist. | tail = =element_prev , |
"llist tail is not being adjusted when removing tail" | |||
) |
fail_unless | ( | llist. | tail = =llist.head , |
"tail and head should be the same" | |||
) |
fail_unless | ( | llist. | tail = =NULL , |
"list tail should intiate to NULL" | |||
) |
fail_unless | ( | llist. | tail = =NULL , |
"llist tail is not NULL while the llist is empty" | |||
) |
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" | |||
) |
fail_unless | ( | llist_size | = =3 , |
"should be 3 list members" | |||
) |
|
static |
Definition at line 30 of file unit1300.c.
|
static |
Definition at line 37 of file unit1300.c.
|
static |
Definition at line 44 of file unit1300.c.
struct curl_llist_element case1_list |
Definition at line 55 of file unit1300.c.
struct curl_llist_element case2_list |
Definition at line 56 of file unit1300.c.
struct curl_llist_element case3_list |
Definition at line 57 of file unit1300.c.
struct curl_llist_element case4_list |
Definition at line 58 of file unit1300.c.
struct curl_llist_element case5_list |
Definition at line 59 of file unit1300.c.
element_next = head->next |
Definition at line 61 of file unit1300.c.
element_prev = to_remove->prev |
Definition at line 62 of file unit1300.c.
head = llist.head |
case 1: list has >1 element, removing head @assumptions: 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 60 of file unit1300.c.
|
static |
testing Curl_llist_insert_next case 1: list is empty @assumptions: 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
@case 1: moving head from an llist containing one element to an empty llist @assumptions: 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
case 2: removing non head element, with list having >=2 elements @setup: 1: insert another element to the list to make element >=2 @assumptions: 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
testing Curl_llist_insert_next case 3: list has >1 element, adding one element after "NULL" @assumptions: 1: the element next to head should be our newly created element 2: the list tail should different from newly created element
testing Curl_llist_insert_next case 2: list has 1 element, adding one element after the head @assumptions: 1: the element next to head should be our newly created element 2: the list tail should be our newly created element
Definition at line 26 of file unit1300.c.
|
static |
Definition at line 28 of file unit1300.c.
llist_size = Curl_llist_count(&llist) |
Definition at line 64 of file unit1300.c.
to_remove = llist.head->next |
case 3: removing the tail with list having >=1 element @assumptions 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 @assumptions: 1: list size will be decremented by one ;tested 2: list head will be null 3: list tail will be null
Definition at line 63 of file unit1300.c.
UNITTEST_START |
Definition at line 51 of file unit1300.c.
int unusedData_case2 = 2 |
Definition at line 53 of file unit1300.c.
int unusedData_case3 = 3 |
Definition at line 54 of file unit1300.c.