er
Tests Basics avec Criterion / test (push) Successful in 7s

This commit is contained in:
2026-04-02 23:30:04 +02:00
parent 7d5bb35f0b
commit 130ff44e16
2 changed files with 4 additions and 6 deletions
@@ -86,9 +86,7 @@ struct list *list_get(struct list *l, size_t index){
while(tmp != NULL && ind < index){ while(tmp != NULL && ind < index){
tmp = tmp->next; tmp = tmp->next;
ind ++; ind ++;
} }
if(ind >= index) return NULL;
return tmp; return tmp;
+3 -3
View File
@@ -24,7 +24,7 @@ Test(basics_suite, test_append) {
Test(basics_suite, test_count) { Test(basics_suite, test_count) {
struct list *l = NULL; struct list *l = NULL;
cr_assert_eq(list_count(l), 0, "Une liste vide doit avoir une taille de 0."); cr_assert_eq(list_count(l), 0, "doit renvoyer 0, c'est un liste vide");
l = list_append(l, 10); l = list_append(l, 10);
l = list_append(l, 20); l = list_append(l, 20);
@@ -129,9 +129,9 @@ Test(basics_suite, test_list_remove){
l = list_append(l, 7); l = list_append(l, 7);
l = list_append(l, 3); l = list_append(l, 3);
l = list_append(l, 7); l = list_append(l, 7);
l = list_append(l, 1); // [1] -> [7] -> [3] -> [1] l = list_append(l, 1); // [1] -> [7] -> [3] -> [7]
int rm = list_remove(&l, 7); // Retire le premier 7. l devient [1] -> [7] -> [3] int rm = list_remove(&l, 7); // Retire le premier 7. l devient [1] -> [3] -> [7]
cr_assert_eq(rm, 1, "Le noeud 7 doit etre supprimé"); cr_assert_eq(rm, 1, "Le noeud 7 doit etre supprimé");
struct list *tmp = list_get(l, 0); struct list *tmp = list_get(l, 0);