From 4388cc2d74f1ee8930ca1baaeeea67da925f8a2c Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 13 Apr 2020 15:03:29 +0200 Subject: Added argument precsion in error message for all function but ft_strdup, Changed function prototype style --- test/ft_strcpy_test.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'test/ft_strcpy_test.c') diff --git a/test/ft_strcpy_test.c b/test/ft_strcpy_test.c index 7929b2f..6b038bb 100644 --- a/test/ft_strcpy_test.c +++ b/test/ft_strcpy_test.c @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:58 by cacharle #+# #+# */ -/* Updated: 2020/02/08 03:07:59 by cacharle ### ########.fr */ +/* Updated: 2020/04/13 15:02:13 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,19 +16,23 @@ static char expected_buf[FT_STRCPY_BUF_SIZE] = {0}; static char actual_buf[FT_STRCPY_BUF_SIZE] = {0}; +static char pre_expected_buf[FT_STRCPY_BUF_SIZE] = {0}; +static char pre_actual_buf[FT_STRCPY_BUF_SIZE] = {0}; -#define FT_STRCPY_EXPECT(str) do { \ - strcpy(expected_buf, str); \ - ft_strcpy(actual_buf, str); \ +#define FT_STRCPY_EXPECT(str) do { \ + strcpy(pre_expected_buf, expected_buf); \ + strcpy(pre_actual_buf, actual_buf); \ + strcpy(expected_buf, str); \ + ft_strcpy(actual_buf, str); \ if (strcmp(expected_buf, actual_buf) != 0) \ - printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\"\n", test_name, expected_buf, actual_buf); \ - else \ - print_ok(); \ + printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\" with: \"%s\", \"%s\"\n",\ + test_name, expected_buf, actual_buf, pre_expected_buf, pre_actual_buf); \ + else \ + print_ok(); \ } while (0); - -static void -ft_strcpy_test_segfault(void) +static +void ft_strcpy_test_segfault(void) { char buf[FT_STRCPY_BUF_SIZE] = {0}; @@ -45,8 +49,8 @@ ac tortor et lectus fermentum lobortis eu at mauris. Vestibulum sit amet posuere tortor, sit amet consequat amet.")); } -static void -ft_strcpy_test_compare(void) +static +void ft_strcpy_test_compare(void) { FT_STRCPY_EXPECT(""); FT_STRCPY_EXPECT("abc"); @@ -63,8 +67,7 @@ tortor, sit amet consequat amet."); FT_STRCPY_EXPECT("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f"); } -void -ft_strcpy_test(void) +void ft_strcpy_test(void) { test_name = "ft_strcpy.s"; -- cgit