diff --git a/src/test.c b/src/test.c index 82d411bb14a450bdac09fca68d1f7197fb36e2e3..ba5c76f02f96bd1b17b36e73f8c38925a7ab974d 100644 --- a/src/test.c +++ b/src/test.c @@ -101,6 +101,32 @@ void test_multiple_list_insert_after() } +void test_list_remove_node() { + int i1 = 1; + int i2 = 2; + int i3 = 3; + int i4 = 4; + int* tab[3] = {&i1, &i3, &i4}; + + struct list_t * L = new_list(viewInt, freeInt); + + list_insert_last(L, &i1); + list_insert_last(L, &i2); + list_insert_last(L, &i3); + list_insert_last(L, &i4); + + printf("L avant suppression: "); + view_list(L); + + struct list_node_t *node_to_remove = get_list_tail(L); + list_remove_node(L, node_to_remove); + + printf("\nL apres suppression: "); + view_list(L); + + delete_list(L, 0); +} + void viewStr(void* str) { printf("%s", (const char*)str);