Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

More List_pop() tests

  • Loading branch information...
commit bcdb2e5d50ffa73cd2b8f73e64da8d56988498a4 1 parent aadde8f
@tj tj authored
Showing with 16 additions and 0 deletions.
  1. +9 −0 src/list.c
  2. +1 −0  src/list.h
  3. +6 −0 test.c
View
9 src/list.c
@@ -64,6 +64,15 @@ List_push(List *self, ListNode *node) {
}
/*
+ * Return the last node in the list, or NULL.
+ */
+
+ListNode *
+List_pop(List *self) {
+
+}
+
+/*
* Prepend the given node to the list
* and return the node, NULL on failure.
*/
View
1  src/list.h
@@ -75,6 +75,7 @@ ListNode *List_push(List *self, ListNode *node);
ListNode *List_unshift(List *self, ListNode *node);
ListNode *List_find(List *self, void *val);
ListNode *List_at(List *self, int index);
+ListNode *List_pop(List *self);
void List_remove(List *self, ListNode *node);
void List_destroy(List *self);
View
6 test.c
@@ -212,6 +212,12 @@ test_List_pop() {
assert(c == List_pop(list));
assert(2 == list->len);
+ assert(a == list->head);
+ assert(b == list->tail);
+ assert(a == b->prev);
+ assert(NULL == b->next);
+ assert(NULL == c->prev);
+ assert(NULL == c->next);
assert(b == List_pop(list));
assert(1 == list->len);
Please sign in to comment.
Something went wrong with that request. Please try again.