#include <stdio.h>
#include "list.h"
void test_add_door(void) {
struct node *root = init((struct door){1, 0});
struct node *r2 = add_door(root, (struct door){2, 0});
struct node *r3 = add_door(root, (struct door){3, 0});
if (root != NULL && r2 != NULL && r3 != NULL
&& root->next == r3 && r3->next == r2 && r2->next == NULL) {
printf("add_door: SUCCESS\n");
} else {
printf("add_door: FAIL\n");
}
destroy(root);
}
void test_remove_door(void) {
struct node *root = init((struct door){1, 0});
struct node *r2 = add_door(root, (struct door){2, 0});
struct node *new_root = remove_door(r2, root);
if (new_root == root && root->next == NULL) {
printf("remove_door: SUCCESS\n");
} else {
printf("remove_door: FAIL\n");
}
destroy(new_root);
}
int main(void) {
test_add_door();
test_remove_door();
return 0;
}