aboutsummaryrefslogtreecommitdiff
path: root/test/src/lst/test_ft_lstiter.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-18 16:39:52 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-18 16:39:52 +0200
commitdd0c485ac4975b7dd6d2e230213be1da50d0a065 (patch)
tree5fbd967f8b95c72fbb696bb089c2cc349d28b61f /test/src/lst/test_ft_lstiter.c
parent3c3f1115f6e9a9b914e2dcbd796501ca7ce85342 (diff)
downloadlibft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.gz
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.bz2
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.zip
Removing unnecessary stuffmalloc
Diffstat (limited to 'test/src/lst/test_ft_lstiter.c')
-rw-r--r--test/src/lst/test_ft_lstiter.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/test/src/lst/test_ft_lstiter.c b/test/src/lst/test_ft_lstiter.c
deleted file mode 100644
index c8bf90d..0000000
--- a/test/src/lst/test_ft_lstiter.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "libft_test.h"
-
-TEST_GROUP(ft_lstiter);
-
-TEST_SETUP(ft_lstiter)
-{}
-
-TEST_TEAR_DOWN(ft_lstiter)
-{}
-
-static void square_iter_func(void *data)
-{
- int *d = (int*)data;
-
- *d = *d * *d;
-}
-
-TEST(ft_lstiter, basic)
-{
- t_ftlst *lst = NULL;
- int a = 2;
- int b = 3;
- int c = 4;
- int d = 5;
-
- ft_lstiter(lst, square_iter_func);
- TEST_ASSERT_NULL(lst);
-
- ft_lstadd_front(&lst, ft_lstnew(&a));
- ft_lstiter(lst, square_iter_func);
- TEST_ASSERT_EQUAL(4, *(int*)lst->content);
-
- ft_lstadd_front(&lst, ft_lstnew(&b));
- ft_lstiter(lst, square_iter_func);
- TEST_ASSERT_EQUAL(9, *(int*)lst->content);
- TEST_ASSERT_EQUAL(16, *(int*)lst->next->content);
-
- ft_lstadd_front(&lst, ft_lstnew(&c));
- ft_lstiter(lst, square_iter_func);
- TEST_ASSERT_EQUAL(16, *(int*)lst->content);
- TEST_ASSERT_EQUAL(81, *(int*)lst->next->content);
- TEST_ASSERT_EQUAL(256, *(int*)lst->next->next->content);
-
- ft_lstadd_front(&lst, ft_lstnew(&d));
- ft_lstiter(lst, square_iter_func);
- TEST_ASSERT_EQUAL(25, *(int*)lst->content);
- TEST_ASSERT_EQUAL(256, *(int*)lst->next->content);
- TEST_ASSERT_EQUAL(81 * 81, *(int*)lst->next->next->content);
- TEST_ASSERT_EQUAL(256 * 256, *(int*)lst->next->next->next->content);
-
- ft_lstclear(&lst, NULL);
-}