libft_testing/ft_memmove_test.c
2025-10-05 14:16:10 +02:00

62 lines
1.8 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memmove_test.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/10/05 13:21:43 by lalgarra #+# #+# */
/* Updated: 2025/10/05 14:02:12 by lalgarra ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdio.h>
#include <string.h>
/*
static void do_test3(char *prefix)
{
int *buff;
size_t buflen;
size_t size;
buflen = 5;
size = 0;
buff = ft_calloc(buflen, size);
printf("%ssize= %lu; buff == NULL: %i\n", prefix, size, buff == NULL);
free(buff);
}
static void do_test2(char *prefix)
{
int *buff;
size_t buflen;
buflen = 0;
buff = ft_calloc(buflen, sizeof(int));
printf("%sbuflen = %lu; buff == NULL: %i\n", prefix, buflen, buff == NULL);
free(buff);
}
*/
static void do_test1(char *prefix)
{
char buf[128];
int fd;
fd = STDOUT_FILENO;
ft_bzero(buf, 128);
ft_memcpy(buf, "Lorem ipsum dolor sit amet consectetur adipiscing elit.", 20);
ft_putstr_fd(prefix, fd);
ft_putchar_fd('\n', fd);
ft_putstr_fd(buf, fd);
ft_putstr_fd("; ", fd);
ft_memmove(buf + 7, buf, 10);
ft_putendl_fd(buf, fd);
}
int main(void)
{
do_test1("test 1: ");
return (0);
}