test double.c
Tests TP prog-104-p-02-2030 / test (push) Failing after 30s

This commit is contained in:
2026-04-03 17:20:49 +02:00
parent a92c8a4ddf
commit 30efd857c1
@@ -22,19 +22,15 @@ int dlist_insert(struct dlist **l, size_t index, int e)
{
if(!l) return 1;
struct dlist *new_node = malloc(sizeof(struct dlist));
if(!new_node) return 1;
//struct dlist *new_node = malloc(sizeof(struct dlist));
//if(!new_node) return 1;
//struct dlist *tmp = *l;
if(index == 0){
new_node->prev = NULL;
new_node->next = *l;
new_node->data = e;
//new_node->next->prev = new_node;
//dlist_append(*l, e);
*l = dlist_append(*l, e);
if(!l) return 1;
return 0;
}
@@ -48,14 +44,15 @@ int dlist_insert(struct dlist **l, size_t index, int e)
if(!tmp) return 1;
//struct dlist *new_node = malloc(sizeof(struct dlist));
//if(!new_node) return 1;
struct dlist *new_node = malloc(sizeof(struct dlist));
if(!new_node) return 1;
new_node->data = e;
new_node->next = tmp;
tmp->prev->next = new_node;
new_node->prev = tmp->prev;
tmp->prev = new_node;
new_node->next = tmp->next;
new_node->prev = tmp;
if (tmp->next != NULL) tmp->next->prev = new_node;
tmp->next = new_node;
return 0;
@@ -65,10 +62,10 @@ struct dlist *dlist_delete_at(struct dlist **l, size_t index)
{
if(!l || *l) return NULL;
struct dlist *old = *l;
struct dlist *old = NULL;
if(index == 0){
old->next->prev = NULL;
old = *l;
*l = old->next;
return old;
@@ -82,6 +79,8 @@ struct dlist *dlist_delete_at(struct dlist **l, size_t index)
ind ++;
}
if(ind == index -1){
old = tmp->next;