diff options
Diffstat (limited to 'test_mini/libft/test/src')
71 files changed, 0 insertions, 2927 deletions
diff --git a/test_mini/libft/test/src/algo/test_ft_bsearch.c b/test_mini/libft/test/src/algo/test_ft_bsearch.c deleted file mode 100644 index 27858ee..0000000 --- a/test_mini/libft/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); -} diff --git a/test_mini/libft/test/src/algo/test_ft_compar_int.c b/test_mini/libft/test/src/algo/test_ft_compar_int.c deleted file mode 100644 index 39cc322..0000000 --- a/test_mini/libft/test/src/algo/test_ft_compar_int.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_compar_int); - -TEST_SETUP(ft_compar_int) -{} - -TEST_TEAR_DOWN(ft_compar_int) -{} - -TEST(ft_compar_int, basic) -{ - int a = 4; - int b = 3; - - TEST_ASSERT_GREATER_THAN(0, ft_compar_int(&a, &b)); - TEST_ASSERT_LESS_THAN(0, ft_compar_int(&b, &a)); - TEST_ASSERT_EQUAL(0, ft_compar_int(&a, &a)); - TEST_ASSERT_EQUAL(0, ft_compar_int(&b, &b)); -} diff --git a/test_mini/libft/test/src/algo/test_ft_heapsort.c b/test_mini/libft/test/src/algo/test_ft_heapsort.c deleted file mode 100644 index 6c2c3fb..0000000 --- a/test_mini/libft/test/src/algo/test_ft_heapsort.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_heapsort); - -TEST_SETUP(ft_heapsort) -{} - -TEST_TEAR_DOWN(ft_heapsort) -{} - -static int compar(const void *a, const void *b) -{ - return *(int*)a - *(int*)b; -} - -TEST(ft_heapsort, basic) -{ - TEST_IGNORE(); - int arr[] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34}; - int sorted_arr[sizeof(arr)]; - - memcpy(sorted_arr, arr, sizeof(arr)); - qsort(sorted_arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - - ft_heapsort(arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - TEST_ASSERT_EQUAL_INT_ARRAY(sorted_arr, arr, sizeof(arr) / sizeof(int)); -} diff --git a/test_mini/libft/test/src/algo/test_ft_is_set.c b/test_mini/libft/test/src/algo/test_ft_is_set.c deleted file mode 100644 index 604ec53..0000000 --- a/test_mini/libft/test/src/algo/test_ft_is_set.c +++ /dev/null @@ -1,23 +0,0 @@ -#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)); -} diff --git a/test_mini/libft/test/src/algo/test_ft_lfind.c b/test_mini/libft/test/src/algo/test_ft_lfind.c deleted file mode 100644 index 0080d55..0000000 --- a/test_mini/libft/test/src/algo/test_ft_lfind.c +++ /dev/null @@ -1,38 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_lfind); - -TEST_SETUP(ft_lfind) -{} - -TEST_TEAR_DOWN(ft_lfind) -{} - -TEST(ft_lfind, 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); - void *ptr = ft_lfind(arr, &nelp, sizeof(int), &consts); - TEST_ASSERT_EQUAL_PTR(arr + 5, ptr); - - int b = 123; - consts.key = &b; - ptr = ft_lfind(arr, &nelp, sizeof(int), &consts); - TEST_ASSERT_NULL(ptr); - - int c = 34; - consts.key = &c; - ptr = ft_lfind(arr, &nelp, sizeof(int), &consts); - TEST_ASSERT_EQUAL_PTR(arr + 10, ptr); - - int d = 3; - consts.key = &d; - ptr = ft_lfind(arr, &nelp, sizeof(int), &consts); - TEST_ASSERT_EQUAL_PTR(arr, ptr); -} diff --git a/test_mini/libft/test/src/algo/test_ft_lsearch.c b/test_mini/libft/test/src/algo/test_ft_lsearch.c deleted file mode 100644 index 13fae13..0000000 --- a/test_mini/libft/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); -} diff --git a/test_mini/libft/test/src/algo/test_ft_mergesort.c b/test_mini/libft/test/src/algo/test_ft_mergesort.c deleted file mode 100644 index 567e31d..0000000 --- a/test_mini/libft/test/src/algo/test_ft_mergesort.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_mergesort); - -TEST_SETUP(ft_mergesort) -{} - -TEST_TEAR_DOWN(ft_mergesort) -{} - -static int compar(const void *a, const void *b) -{ - return *(int*)a - *(int*)b; -} - -TEST(ft_mergesort, basic) -{ - int arr[] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34}; - int sorted_arr[sizeof(arr)]; - - memcpy(sorted_arr, arr, sizeof(arr)); - qsort(sorted_arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - - ft_mergesort(arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - TEST_ASSERT_EQUAL_INT_ARRAY(sorted_arr, arr, sizeof(arr) / sizeof(int)); -} diff --git a/test_mini/libft/test/src/algo/test_ft_qsort.c b/test_mini/libft/test/src/algo/test_ft_qsort.c deleted file mode 100644 index 25a5ef6..0000000 --- a/test_mini/libft/test/src/algo/test_ft_qsort.c +++ /dev/null @@ -1,26 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_qsort); - -TEST_SETUP(ft_qsort) -{} - -TEST_TEAR_DOWN(ft_qsort) -{} - -static int compar(const void *a, const void *b) -{ - return *(int*)a - *(int*)b; -} - -TEST(ft_qsort, basic) -{ - int arr[] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34}; - int sorted_arr[sizeof(arr)]; - - memcpy(sorted_arr, arr, sizeof(arr)); - qsort(sorted_arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - - ft_qsort(arr, sizeof(arr) / sizeof(int), sizeof(int), compar); - TEST_ASSERT_EQUAL_INT_ARRAY(sorted_arr, arr, sizeof(arr) / sizeof(int)); -} diff --git a/test_mini/libft/test/src/algo/test_ft_reverse.c b/test_mini/libft/test/src/algo/test_ft_reverse.c deleted file mode 100644 index feca520..0000000 --- a/test_mini/libft/test/src/algo/test_ft_reverse.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_reverse); - -TEST_SETUP(ft_reverse) -{} - -TEST_TEAR_DOWN(ft_reverse) -{} - -TEST(ft_reverse, basic) -{ - int arr[] = {3, 4, 1, 2, 7, 189, -1, -134, 7, 1, 34}; - int rev_arr[] = {34, 1, 7, -134, -1, 189, 7, 2, 1, 4, 3}; - - ft_reverse(arr, sizeof(arr) / sizeof(int), sizeof(int)); - TEST_ASSERT_EQUAL_INT_ARRAY(rev_arr, arr, sizeof(arr) / sizeof(int)); - -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isalnum.c b/test_mini/libft/test/src/ctype/test_ft_isalnum.c deleted file mode 100644 index 0019a03..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isalnum.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isalnum); - -TEST_SETUP(ft_isalnum) -{} - -TEST_TEAR_DOWN(ft_isalnum) -{} - -TEST(ft_isalnum, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isalnum(i), !!ft_isalnum(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isalpha.c b/test_mini/libft/test/src/ctype/test_ft_isalpha.c deleted file mode 100644 index 9846985..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isalpha.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isalpha); - -TEST_SETUP(ft_isalpha) -{} - -TEST_TEAR_DOWN(ft_isalpha) -{} - -TEST(ft_isalpha, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isalpha(i), !!ft_isalpha(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isascii.c b/test_mini/libft/test/src/ctype/test_ft_isascii.c deleted file mode 100644 index c052571..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isascii.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isascii); - -TEST_SETUP(ft_isascii) -{} - -TEST_TEAR_DOWN(ft_isascii) -{} - -TEST(ft_isascii, base) -{ - for (int i = 0; i < UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isascii(i), !!ft_isascii(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isblank.c b/test_mini/libft/test/src/ctype/test_ft_isblank.c deleted file mode 100644 index 3c8460f..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isblank.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isblank); - -TEST_SETUP(ft_isblank) -{} - -TEST_TEAR_DOWN(ft_isblank) -{} - -TEST(ft_isblank, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isblank(i), !!ft_isblank(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isdigit.c b/test_mini/libft/test/src/ctype/test_ft_isdigit.c deleted file mode 100644 index 74c210b..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isdigit.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isdigit); - -TEST_SETUP(ft_isdigit) -{} - -TEST_TEAR_DOWN(ft_isdigit) -{} - -TEST(ft_isdigit, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isdigit(i), !!ft_isdigit(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isprint.c b/test_mini/libft/test/src/ctype/test_ft_isprint.c deleted file mode 100644 index 0f15661..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isprint.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isprint); - -TEST_SETUP(ft_isprint) -{} - -TEST_TEAR_DOWN(ft_isprint) -{} - -TEST(ft_isprint, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isprint(i), !!ft_isprint(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_isspace.c b/test_mini/libft/test/src/ctype/test_ft_isspace.c deleted file mode 100644 index f94a1ea..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_isspace.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_isspace); - -TEST_SETUP(ft_isspace) -{} - -TEST_TEAR_DOWN(ft_isspace) -{} - -TEST(ft_isspace, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(!!isspace(i), !!ft_isspace(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_todigit.c b/test_mini/libft/test/src/ctype/test_ft_todigit.c deleted file mode 100644 index cd8d9f3..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_todigit.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_todigit); - -TEST_SETUP(ft_todigit) -{} - -TEST_TEAR_DOWN(ft_todigit) -{} - -TEST(ft_todigit, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - { - if (isdigit(i)) - TEST_ASSERT_EQUAL(i - '0', ft_todigit(i)); - else - TEST_ASSERT_EQUAL(-1, ft_todigit(i)); - } -} diff --git a/test_mini/libft/test/src/ctype/test_ft_tolower.c b/test_mini/libft/test/src/ctype/test_ft_tolower.c deleted file mode 100644 index 9465544..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_tolower.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_tolower); - -TEST_SETUP(ft_tolower) -{} - -TEST_TEAR_DOWN(ft_tolower) -{} - -TEST(ft_tolower, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(tolower(i), ft_tolower(i)); -} diff --git a/test_mini/libft/test/src/ctype/test_ft_toupper.c b/test_mini/libft/test/src/ctype/test_ft_toupper.c deleted file mode 100644 index b23c08b..0000000 --- a/test_mini/libft/test/src/ctype/test_ft_toupper.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "libft_test.h" - -TEST_GROUP(ft_toupper); - -TEST_SETUP(ft_toupper) -{} - -TEST_TEAR_DOWN(ft_toupper) -{} - -TEST(ft_toupper, base) -{ - for (int i = 0; i <= UCHAR_MAX; i++) - TEST_ASSERT_EQUAL(toupper(i), ft_toupper(i)); -} diff --git a/test_mini/libft/test/src/ht/test_ft_htdelone.c b/test_mini/libft/test/src/ht/test_ft_htdelone.c deleted file mode 100644 index 5ba4822..0000000 --- a/test_mini/libft/test/src/ht/test_ft_htdelone.c +++ /dev/null @@ -1,68 +0,0 @@ -/* *********************************** |
