/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ex00.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: achubuko +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/11/29 19:42:18 by achubuko #+# #+# */ /* Updated: 2023/11/29 22:14:59 by achubuko ### ########.fr */ /* */ /* ************************************************************************** */ #include #include #define TEST_BUF_SIZE 100 int ft_strncmp(char *s1, char *s2, unsigned int n); int main(void) { char s[TEST_BUF_SIZE] = "Hello World!"; char d1[TEST_BUF_SIZE] = "Hello World!"; char d2[TEST_BUF_SIZE] = "Hello Sarld!"; char d3[TEST_BUF_SIZE] = "Hell"; int r1; int r2; printf("initial strings:\n"); dump(s, 20); dump(d1, 20); dump(d2, 20); dump(d3, 20); printf("strncmp(d2, s, 5):\n"); r1 = strncmp(d2, s, 5); r2 = ft_strncmp(d2, s, 5); printf("return values: orig: %i ft: %i\n", r1, r2); printf("strncmp(s, d2, 20):\n"); r1 = strncmp(s, d2, 20); r2 = ft_strncmp(s, d2, 20); printf("return values: orig: %i ft: %i\n", r1, r2); printf("strncmp(s, d1, 15):\n"); r1 = strncmp(s, d1, 15); r2 = ft_strncmp(s, d1, 15); printf("return values: orig: %i ft: %i\n", r1, r2); printf("strncmp(s, d3, 15):\n"); r1 = strncmp(s, d3, 15); r2 = ft_strncmp(s, d3, 15); printf("return values: orig: %i ft: %i\n", r1, r2); return 0; } void setUp(void) { } void tearDown(void) { }