libft
Loading...
Searching...
No Matches
test_libft.c
Go to the documentation of this file.
1#include "unity.h"
2#include "libft.h"
3
6}
7
10}
13}
14
16{
17 char *string = " Is th|is a| real ...| nah";
18 char **expected = ((char*[5]){" Is th", "is a", " real ...", " nah", NULL});
19 char **actual = ft_split(string, '|');
20 TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, 5);
21 for (int i = 0; i < 5; i++)
22 free(actual[i]);
23 free(actual);
24}
25
26int test_libft(void)
27{
33 return UNITY_END();
34}
int ft_isdigit(int c)
Check if char is digit.
Definition ft_isdigit.c:13
char ** ft_split(char const *s, char c)
Splits string to substrings.
Definition ft_split.c:71
int ft_atoi(const char *str)
ASCII to integer.
Definition ft_atoi.c:15
void test_ft_isdigit_should_be_false(void)
Definition test_libft.c:11
void test_ft_isdigit_should_be_true(void)
Definition test_libft.c:8
int test_libft(void)
Definition test_libft.c:26
void test_ft_atoi_should_be_equal_int(void)
Definition test_libft.c:4
void test_tf_split_should_be_equal(void)
Definition test_libft.c:15
#define TEST_ASSERT_TRUE(condition)
Definition unity.h:126
#define TEST_ASSERT_FALSE(condition)
Definition unity.h:128
#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements)
Definition unity.h:312
#define TEST_ASSERT_EQUAL_INT(expected, actual)
Definition unity.h:135
#define RUN_TEST(func)
#define UNITY_END()
#define UNITY_BEGIN()