added bgoulard lib + made lib sources in their own directory in build/ for readability
This commit is contained in:
parent
83cc8419a0
commit
0a390934d6
457 changed files with 21807 additions and 61 deletions
37
libft_personal/tests/ft_string/ft_mem/tests_memmove.c
Normal file
37
libft_personal/tests/ft_string/ft_mem/tests_memmove.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* tests_memmove.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/25 12:21:39 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/06/26 19:27:55 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_string.h"
|
||||
|
||||
// last ft_memmove is a test to check that we do nothing on
|
||||
// dst if src and dst are the same otherwise it will segfault
|
||||
int test_memmove(void)
|
||||
{
|
||||
char str[10];
|
||||
const char str3[] = "1234567a9";
|
||||
|
||||
ft_strlcpy(str, "123456789", 10);
|
||||
ft_memmove(str, "abc", 3);
|
||||
if (ft_memcmp(str, "abc456789", 10) != 0)
|
||||
return (1);
|
||||
ft_memmove(str, str3, 10);
|
||||
if (ft_memcmp(str, str3, 10) != 0)
|
||||
return (2);
|
||||
ft_memmove(str, str + 2, 5);
|
||||
if (ft_memcmp(str, "3456767a9", 10) != 0)
|
||||
return (3);
|
||||
ft_memmove(str + 2, str, 5);
|
||||
if (ft_memcmp(str, "3434567a9", 10) != 0)
|
||||
return (4);
|
||||
ft_memmove(str, str, 999);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue