aboutsummaryrefslogtreecommitdiff
path: root/test/src/algo/test_ft_bsearch.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_bsearch.c
parent3c3f1115f6e9a9b914e2dcbd796501ca7ce85342 (diff)
downloadlibft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.gz
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.tar.bz2
libft-dd0c485ac4975b7dd6d2e230213be1da50d0a065.zip
Removing unnecessary stuffmalloc
Diffstat (limited to 'test/src/algo/test_ft_bsearch.c')
-rw-r--r--test/src/algo/test_ft_bsearch.c55
1 files changed, 0 insertions, 55 deletions
diff --git a/test/src/algo/test_ft_bsearch.c b/test/src/algo/test_ft_bsearch.c
deleted file mode 100644
index 27858ee..0000000
--- a/test/src/algo/test_ft_bsearch.c
+++ /dev/null
@@ -1,55 +0,0 @@
-#include "libft_test.h"
-
-TEST_GROUP(ft_bsearch);
-
-TEST_SETUP(ft_bsearch)
-{}
-
-TEST_TEAR_DOWN(ft_bsearch)
-{}
-
-TEST(ft_bsearch, basic)
-{
- int arr[] = {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 = sizeof(arr) / sizeof(int);
- qsort(arr, nelp, sizeof(int), ft_compar_int);
-
- void *ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-
- int b = 123;
- consts.key = &b;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_NULL(ptr);
-
- int c = -134;
- consts.key = &c;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-
- int e = 1;
- consts.key = &e;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-
- int d = -1;
- consts.key = &d;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-
- int f = 34;
- consts.key = &f;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-
- int g = 7;
- consts.key = &g;
- ptr = ft_bsearch(arr, nelp, sizeof(int), &consts);
- TEST_ASSERT_EQUAL_PTR(bsearch(consts.key, arr, nelp, sizeof(int), consts.compar), ptr);
-}