first commit
This commit is contained in:
39
tests/01_stack.c
Normal file
39
tests/01_stack.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#define DEBUG
|
||||
#include "../include/link.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void){
|
||||
List s1 = NULL;
|
||||
struct Node *n1 = node_alloc(1);
|
||||
struct Node *n2 = node_alloc(2);
|
||||
struct Node *n3 = node_alloc(3);
|
||||
struct Node *n4 = node_alloc(4);
|
||||
|
||||
stack_push(&s1, n4);
|
||||
stack_push(&s1, n3);
|
||||
stack_push(&s1, n2);
|
||||
stack_push(&s1, n1);
|
||||
|
||||
|
||||
list_print(&s1);
|
||||
uint64_t test1 = stack_pop(&s1);
|
||||
printf("Removed %ld from end of list.\n", test1);
|
||||
list_print(&s1);
|
||||
|
||||
uint64_t test2 = stack_pop(&s1);
|
||||
printf("Removed %ld from end of list.\n", test2);
|
||||
list_print(&s1);
|
||||
|
||||
uint64_t test3 = stack_pop(&s1);
|
||||
printf("Removed %ld from end of list.\n", test3);
|
||||
list_print(&s1);
|
||||
|
||||
uint64_t test4 = stack_pop(&s1);
|
||||
printf("Removed %ld from end of list.\n", test4);
|
||||
list_print(&s1);
|
||||
|
||||
list_free(&s1);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user