diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-16 04:51:41 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-16 04:51:41 +0100 |
| commit | 01b4cc91d1596cf94d709a627ed8ad64bc1e285d (patch) | |
| tree | 8b15a7758247ed4d4a084bccefedbf426ddfd305 /test/src/lst/test_ft_lstbsearch.c | |
| parent | bf4dc8e5c1dbb8149f0cab473f73b5e9bac24ae0 (diff) | |
| download | libft-01b4cc91d1596cf94d709a627ed8ad64bc1e285d.tar.gz libft-01b4cc91d1596cf94d709a627ed8ad64bc1e285d.tar.bz2 libft-01b4cc91d1596cf94d709a627ed8ad64bc1e285d.zip | |
Filled lst* tests
Diffstat (limited to 'test/src/lst/test_ft_lstbsearch.c')
| -rw-r--r-- | test/src/lst/test_ft_lstbsearch.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/src/lst/test_ft_lstbsearch.c b/test/src/lst/test_ft_lstbsearch.c index 0f40780..218f0bf 100644 --- a/test/src/lst/test_ft_lstbsearch.c +++ b/test/src/lst/test_ft_lstbsearch.c @@ -10,5 +10,28 @@ TEST_TEAR_DOWN(ft_lstbsearch) TEST(ft_lstbsearch, basic) { + t_ftlst *found = NULL; + t_ftlst *lst = NULL; + int a = 1; + int b = 2; + int c = 3; + int d = 4; + ft_lstadd_front(&lst, ft_lstnew(&c)); + ft_lstadd_front(&lst, ft_lstnew(&b)); + ft_lstadd_front(&lst, ft_lstnew(&a)); + ft_lstadd_front(&lst, ft_lstnew(&a)); + + found = ft_lstbsearch(lst, ft_compar_int, &c); + TEST_ASSERT_NOT_NULL(found); + found = ft_lstbsearch(lst, ft_compar_int, &c); + TEST_ASSERT_NOT_NULL(found); + found = ft_lstbsearch(lst, ft_compar_int, &b); + TEST_ASSERT_NOT_NULL(found); + found = ft_lstbsearch(lst, ft_compar_int, &a); + TEST_ASSERT_NOT_NULL(found); + found = ft_lstbsearch(lst, ft_compar_int, &d); + TEST_ASSERT_NULL(found); + + ft_lstclear(&lst, NULL); } |
