Files
link/tests/02_queue.c
2026-03-10 19:01:36 -05:00

40 lines
994 B
C

#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);
list_insert_at(&s1, n4,-1);
list_insert_at(&s1, n3,-1);
list_insert_at(&s1, n2,-1);
list_insert_at(&s1, n1,-1);
list_print(&s1);
uint64_t test1 = list_delete_at(&s1,-1);
printf("Removed %ld from end of list.\n", test1);
list_print(&s1);
uint64_t test2 = list_delete_at(&s1,-1);
printf("Removed %ld from end of list.\n", test2);
list_print(&s1);
uint64_t test3 = list_delete_at(&s1,-1);
printf("Removed %ld from end of list.\n", test3);
list_print(&s1);
uint64_t test4 = list_delete_at(&s1,-1);
printf("Removed %ld from end of list.\n", test4);
list_print(&s1);
list_free(&s1);
return EXIT_SUCCESS;
}