aboutsummaryrefslogtreecommitdiff
path: root/test/src/lst/test_ft_lstlast.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/lst/test_ft_lstlast.c')
-rw-r--r--test/src/lst/test_ft_lstlast.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/lst/test_ft_lstlast.c b/test/src/lst/test_ft_lstlast.c
index f7dffe2..6b44c28 100644
--- a/test/src/lst/test_ft_lstlast.c
+++ b/test/src/lst/test_ft_lstlast.c
@@ -10,5 +10,20 @@ TEST_TEAR_DOWN(ft_lstlast)
TEST(ft_lstlast, basic)
{
+ t_ftlst *lst = NULL;
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+ ft_lstadd_front(&lst, ft_lstnew(&a));
+ TEST_ASSERT_EQUAL_PTR(lst, ft_lstlast(lst));
+ ft_lstadd_front(&lst, ft_lstnew(&b));
+ TEST_ASSERT_EQUAL_PTR(lst->next, ft_lstlast(lst));
+ ft_lstadd_front(&lst, ft_lstnew(&c));
+ TEST_ASSERT_EQUAL_PTR(lst->next->next, ft_lstlast(lst));
+ ft_lstadd_front(&lst, ft_lstnew(&d));
+ TEST_ASSERT_EQUAL_PTR(lst->next->next->next, ft_lstlast(lst));
+
+ ft_lstclear(&lst, NULL);
}