aboutsummaryrefslogtreecommitdiff
path: root/test/src/algo/test_ft_lsearch.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/algo/test_ft_lsearch.c
parent3c3f1115f6e9a9b914e2dcbd796501ca7ce85342 (diff)
downloadlibft-malloc.tar.gz
libft-malloc.tar.bz2
libft-malloc.zip
Removing unnecessary stuffmalloc
Diffstat (limited to 'test/src/algo/test_ft_lsearch.c')
-rw-r--r--test/src/algo/test_ft_lsearch.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/test/src/algo/test_ft_lsearch.c b/test/src/algo/test_ft_lsearch.c
deleted file mode 100644
index 13fae13..0000000
--- a/test/src/algo/test_ft_lsearch.c
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "libft_test.h"
-
-TEST_GROUP(ft_lsearch);
-
-TEST_SETUP(ft_lsearch)
-{}
-
-TEST_TEAR_DOWN(ft_lsearch)
-{}
-
-TEST(ft_lsearch, basic)
-{
- int arr[32] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34};
- t_ftsearch_const consts;
-
- int a = 189;
- consts.key = &a;
- consts.compar = ft_compar_int;
-
- size_t nelp = 11;
- void *ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(arr + 5, ptr);
-
- int c = 34;
- consts.key = &c;
- ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(arr + 10, ptr);
-
- int d = 3;
- consts.key = &d;
- ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(arr, ptr);
-
- int b = 123;
- consts.key = &b;
- ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL(12, nelp);
- TEST_ASSERT_EQUAL(123, arr[11]);
- TEST_ASSERT_EQUAL_PTR(arr + 11, ptr);
-
- ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL(12, nelp);
- TEST_ASSERT_EQUAL(123, arr[11]);
- TEST_ASSERT_EQUAL_PTR(arr + 11, ptr);
-
- int e = 1234;
- consts.key = &e;
- ptr = ft_lsearch(arr, &nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL(13, nelp);
- TEST_ASSERT_EQUAL(1234, arr[12]);
- TEST_ASSERT_EQUAL_PTR(arr + 12, ptr);
-}