diff --git a/Chains_across_the_Island/Fundamentals/basics/basics.c b/Chains_across_the_Island/Fundamentals/basics/basics.c index 0ddaa6d..1650825 100644 --- a/Chains_across_the_Island/Fundamentals/basics/basics.c +++ b/Chains_across_the_Island/Fundamentals/basics/basics.c @@ -86,9 +86,7 @@ struct list *list_get(struct list *l, size_t index){ while(tmp != NULL && ind < index){ tmp = tmp->next; ind ++; - } - - if(ind >= index) return NULL; + } return tmp; diff --git a/tests/test_basics.c b/tests/test_basics.c index d66ffeb..db2d3d6 100644 --- a/tests/test_basics.c +++ b/tests/test_basics.c @@ -24,7 +24,7 @@ Test(basics_suite, test_append) { Test(basics_suite, test_count) { 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, 20); @@ -129,9 +129,9 @@ Test(basics_suite, test_list_remove){ l = list_append(l, 7); l = list_append(l, 3); 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é"); struct list *tmp = list_get(l, 0);