diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-13 23:15:16 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-13 23:15:16 +0100 |
| commit | adbcf69ed50ea3896d4bbe863ea5d214ae5a0299 (patch) | |
| tree | 4865b665e44711b7675c78a4152985ea451eca79 /test/src/algo/test_ft_is_set.c | |
| parent | 7d626e7e9638d7e85c3dacce8a4aee009850a1a2 (diff) | |
| download | libft-adbcf69ed50ea3896d4bbe863ea5d214ae5a0299.tar.gz libft-adbcf69ed50ea3896d4bbe863ea5d214ae5a0299.tar.bz2 libft-adbcf69ed50ea3896d4bbe863ea5d214ae5a0299.zip | |
Added tests for algo*, fixing ft_bsearch and ft_mergesort
Diffstat (limited to 'test/src/algo/test_ft_is_set.c')
| -rw-r--r-- | test/src/algo/test_ft_is_set.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/src/algo/test_ft_is_set.c b/test/src/algo/test_ft_is_set.c new file mode 100644 index 0000000..604ec53 --- /dev/null +++ b/test/src/algo/test_ft_is_set.c @@ -0,0 +1,23 @@ +#include "libft_test.h" + +TEST_GROUP(ft_is_set); + +TEST_SETUP(ft_is_set) +{} + +TEST_TEAR_DOWN(ft_is_set) +{} + +static int compar(const void *a, const void *b) +{ + return *(int*)a - *(int*)b; +} + +TEST(ft_is_set, basic) +{ + int arr[] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34}; + int unique_arr[] = {3, 4, 2, 189, -1, -134, 7, 1, 34}; + + TEST_ASSERT_FALSE(ft_is_set(arr, sizeof(arr) / sizeof(int), sizeof(int), compar)); + TEST_ASSERT_TRUE(ft_is_set(unique_arr, sizeof(unique_arr) / sizeof(int), sizeof(int), compar)); +} |
