int	ft_test_strnew(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_strnew & ft_strdel");
	res += ft_test_strnew2(1024);
	res += ft_test_strnew2(1);
	return (ft_print_end(res));
}
Esempio n. 2
0
int			ft_test_strdup(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_strdup");
	res += ft_test_strdup2("Hello world !");
	res += ft_test_strdup2("");
	return (ft_print_end(res));
}
int	ft_test_memmove(void)
{
	int		res;
	char	str[] = "bonjour tout le monde";

	res = 0;
	ft_print_begin("ft_memmove");
	res += ft_test_memmove2((void *)(str + 1), (const void *)str, strlen(str));
	return (ft_print_end(res));
}
Esempio n. 4
0
int	ft_test_putchar_fd(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_putchar_fd");
	res += ft_test_putchar_fd2('t');
	res += ft_test_putchar_fd2('\n');
	return (ft_print_end(res));
}
Esempio n. 5
0
int			ft_test_strlen(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_strlen");
	res += ft_test_strlen2("hello world !");
	res += ft_test_strlen2("");
	return (ft_print_end(res));
}
int	ft_test_strsub(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_strsub");
	res += ft_test_strsub2("Bonjour", 2, 3, "njo");
	res += ft_test_strsub2("Bonjour", 0, 0, "");
	res += ft_test_strsub2("Bienvenue", 7, 2, "ue");
	return (ft_print_end(res));
}
Esempio n. 7
0
int	ft_test_isalpha(void)
{
	int	res;
	int	i;

	res = 0;
	i = 0;
	ft_print_begin("ft_isalpha");
	while (i++ < 255)
		res += ft_test_isalpha2((char)i);
	return (ft_print_end(res));
}
Esempio n. 8
0
int	ft_test_toupper(void)
{
	int	res;
	int	i;

	res = 0;
	i = 0;
	ft_print_begin("ft_toupper");
	while (i++ < 255)
		res += ft_test_toupper2((char)i);
	return (ft_print_end(res));
}
int			ft_test_memset(void)
{
	int res;
	char str[] = "Bonjour";
	char str2[] = "bonjour";

	res = 0;
	ft_print_begin("ft_memset");
	res += ft_test_memset2(str, str2, 4);
	ft_print_end(res);
	return (res);
}
int	ft_test_strcat(void)
{
	int		res;
	char	buf[100];

	res = 0;
	buf[0] = 0;
	ft_print_begin("ft_strcat");
	res += ft_test_strcat2(buf, "Hello", 100);
	res += ft_test_strcat2(buf, "world !", 100);
	res += ft_test_strcat2(buf, "", 100);
	return (ft_print_end(res));
}
Esempio n. 11
0
int	ft_test_strchr(void)
{
	int		res;
	char	*str = "Hello world !";

	res = 0;
	ft_print_begin("ft_strchr");
	res += ft_test_strchr2(str, '!');
	res += ft_test_strchr2(str, 0);
	res += ft_test_strchr2(str, 'H');
	res += ft_test_strchr2(str, 'z');
	return (ft_print_end(res));
}
Esempio n. 12
0
int			ft_test_bzero()
{
	int			res;
	t_struct1	s_test;

	res = 0;
	ft_print_begin("ft_bzero");
	s_test.m_str = "You will fail :D";
	s_test.m_char = 't';
	s_test.m_int = 45;
	res += ft_test_bzero2(&s_test, sizeof(t_struct1));
	return (ft_print_end(res));
}
int	ft_test_isascii(void)
{
	int	            res;
	int   c;

	c = -5;
	res = 0;
	ft_print_begin("ft_isascii");
	while (c <= 200)
	{
	  res += ft_test_isascii2(c);
	  c++;
	}
	return (ft_print_end(res));
}
int	ft_test_toupper(void)
{
	int 	res;
  char  c;

	res = 0;
	c = 'a';
	ft_print_begin("ft_toupper");
	while (c <= 'z')
	{
	  res += ft_test_toupper2((char)c);
    c++;
  }
	return (ft_print_end(res));
}
Esempio n. 15
0
int			ft_test_strcmp(void)
{
	int 	res;
	char	str[] = "cba";
	char	str2[] = "abc";	

	res = 0;
	ft_print_begin("ft_strcmp");
	res += ft_test_strcmp2("test", "testing");
	res += ft_test_strcmp2(str, str2);
	res += ft_test_strcmp2("bonjour", "");
	res += ft_test_strcmp2("hello", "hello");
	res += ft_test_strcmp2("", "");
	return (ft_print_end(res));
}
Esempio n. 16
0
int	ft_test_strncmp(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_strncmp");
	res += ft_test_strncmp2("Zelcome", "Welcome", 1);
	res += ft_test_strncmp2("Welcome", "welcome", 7);
	res += ft_test_strncmp2("Hello", "", 6);
	res += ft_test_strncmp2("", "", 0);
	res += ft_test_strncmp2("bonjour", "bonjour", 7);
	res += ft_test_strncmp2("bonjour", "bonjour", 8);
	res += ft_test_strncmp2("bonjour", "bonjour", 100);
	res += ft_test_strncmp2("cba", "abc", 2);
	return (ft_print_end(res));
}
int	ft_test_tolower(void)
{
	int	res;
	char  c;

	c = 'A';

	res = 0;
	ft_print_begin("ft_tolower");
	while (c <= 'Z')
	{
	  	res += ft_test_tolower2(c);
	  	c++;
	}
	return (ft_print_end(res));
}
int	ft_test_strchr(void)
{
	int			res;
	const char		str[] = "Hello world !";
	char		c;

	res = 0;
	ft_print_begin("ft_strchr");
	c = 'a';
	res += ft_test_strchr2(str, 'H');
	while (c <= 'z')
		res += ft_test_strchr2(str, c++);
	res += ft_test_strchr2(str, '!');
	res += ft_test_strchr2(str, 0);
	return (ft_print_end(res));
}
int			ft_test_strcpy(void)
{
	int		res;
	char	str[] = "bonjour tout le monde";
	char	str2[5] = "";
	char	str3[] = "";

	res = 0;
	ft_print_begin("ft_strcpy");
	res += ft_test_strcpy2(str, "test");
	res += ft_test_strcpy2(str2, "world");
	res += ft_test_strcpy2(str2, "world");
	res += ft_test_strcpy2(str2, "world");
	res += ft_test_strcpy2(str3, "world");
	res += ft_test_strcpy2(str3, "");
	res += ft_test_strcpy2(str3, "World");
	return (ft_print_end(res));
}
int	ft_test_atoi(void)
{
	int	res;

	res = 0;
	ft_print_begin("ft_atoi");
	res += ft_test_atoi2("125");
	res += ft_test_atoi2("0");
	res += ft_test_atoi2("2000000");
	res += ft_test_atoi2("\0\v\t\n\r\f2000000");
	res += ft_test_atoi2("-2147483648");
	res += ft_test_atoi2("2147483647");
	res += ft_test_atoi2("-458");
	res += ft_test_atoi2("+123");
	res += ft_test_atoi2("154abcd");
	res += ft_test_atoi2("rwer");
	res += ft_test_atoi2("");
	return (ft_print_end(res));
}
int	ft_test_lstiter(void)
{
	int		res;
	int		i1;
	int		i2;
	t_list	*elem;
	t_list	*elem2;
	int		*tmp1;
	int		*tmp2;

	res = 0;
	i1 = 150;
	i2 = -130;
	ft_print_begin("ft_lstiter");
	elem = (t_list*)malloc(sizeof(t_list));
	elem2 = (t_list*)malloc(sizeof(t_list));
	elem->next = elem2;
	elem->content = (void *)&i1;
	elem->content_size = elem2->content_size = sizeof(int);
	elem2->content = (void *)&i2;
	elem2->content_size = elem2->content_size = sizeof(int);
	elem2->next = NULL;;
	ft_lstiter(elem, ft_test_lstiter_iter);
	tmp1 = (int *) elem->content;
	tmp2 = (int *) elem2->content;
	if (*tmp1 != 151)
	{
		printf("*(elem->content) (%d) != (151)\n", *tmp1);
		res++;
	}
	else if (*tmp2 != -129)
	{
		printf("*(elem2->content) (%d) != (-129)\n", *tmp2);
		res++;
	}
	else
	{
		printf("Test passed function passed as argument was applied./n");
	}
	printf("Test");
	ft_print_status(res);
	return (ft_print_end(res));
}
int			ft_test_memcpy(void)
{
	int	  res;
	char  *tmp;
	t_struct1 t1;
	t_struct1 t2;
	int   *test_ptr;

  test_ptr = (int * ) malloc(sizeof(int) * 2);
  tmp = (char *) malloc(sizeof(char) * strlen("test"));
	t1.m_str = tmp;
	t1.m_char = 'q';
	t1.m_pointer = (void *)test_ptr;
	res = 0;
	ft_print_begin("ft_memcpy");
	ft_test_memcpy2((void *)&t2, (const void *)&t1, sizeof(t_struct1));
  free(tmp);
  free(test_ptr);
	return (ft_print_end(res));
}
Esempio n. 23
0
void	colle(int x, int y)
{
	int count_y;

	count_y = 1;
	while (count_y <= y)
	{
		if (count_y == 1)
		{
			ft_print_begin(x);
		}
		else if (count_y == y)
		{
			ft_print_end(x);
		}
		else
		{
			ft_print_empty_line(x);
		}
		if (x > 0)
			ft_putchar('\n');
		count_y++;
	}
}