c03: more mains

This commit is contained in:
Aleksei Chubukov 2023-11-30 21:36:48 +04:00
parent 5d2cf7f9c7
commit 3974d8f2da
2 changed files with 72 additions and 0 deletions

36
c03/ex02.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ex02.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/30 19:58:12 by achubuko #+# #+# */
/* Updated: 2023/11/30 21:14:32 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include <tests.h>
#define TESTS_RETURN_PRINTF "%p"
char *ft_strcat(char *dest, char *src);
int main(void)
{
TESTS_SEED(char);
printf("initial strings:\n");
dump(s, TEST_SOURCE_LENGHT);
dump(d, TEST_DESTINATION_LENGHT);
r1 = strcat(d1, s1);
r2 = ft_strcat(d2, s2);
TESTS_SYNOPSIS("strcat(d, s)");
r1 = strcat(d1, s1);
r2 = ft_strcat(d2, s2);
TESTS_SYNOPSIS("strcat(d, s)");
r1 = strcat(s1, d1);
r2 = ft_strcat(s2, d2);
TESTS_SYNOPSIS("strcat(s, d)");
}

36
c03/ex03.c Normal file
View File

@ -0,0 +1,36 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ex02.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: achubuko <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/11/30 19:58:12 by achubuko #+# #+# */
/* Updated: 2023/11/30 21:32:12 by achubuko ### ########.fr */
/* */
/* ************************************************************************** */
#include <tests.h>
#define TESTS_RETURN_PRINTF "%p"
char *ft_strncat(char *dest, char *src, unsigned int nb);
int main(void)
{
TESTS_SEED(char);
printf("initial strings:\n");
dump(s, TEST_SOURCE_LENGHT);
dump(d, TEST_DESTINATION_LENGHT);
r1 = strncat(d1, s1, 6);
r2 = ft_strncat(d2, s2, 6);
TESTS_SYNOPSIS("strncat(d, s, 6)");
r1 = strncat(d1, s1, 20);
r2 = ft_strncat(d2, s2, 20);
TESTS_SYNOPSIS("strncat(d, s, 20)");
r1 = strncat(s1, d1, 5);
r2 = ft_strncat(s2, d2, 5);
TESTS_SYNOPSIS("strncat(s, d, 5)");
}