diff options
Diffstat (limited to 'test/ft_strlen_test.c')
| -rw-r--r-- | test/ft_strlen_test.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/test/ft_strlen_test.c b/test/ft_strlen_test.c index 1c500ae..e92f668 100644 --- a/test/ft_strlen_test.c +++ b/test/ft_strlen_test.c @@ -6,19 +6,32 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:53 by cacharle #+# #+# */ -/* Updated: 2020/02/08 03:07:53 by cacharle ### ########.fr */ +/* Updated: 2020/04/12 20:08:55 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "libasm_test.h" +int actual; +int expected; + +#define FT_STRLEN_EXPECT(str) do { \ + actual = ft_strlen(str); \ + expected = strlen(str); \ + if (actual != expected) \ + printf("KO: [COMPARE]: %s: expected: %d got: %d with: "#str"\n", \ + test_name, expected, actual); \ + else \ + print_ok(); \ +} while (0); + static void ft_strlen_test_segfault(void) { TEST_ASM_FUNCTION(ft_strlen("")); TEST_ASM_FUNCTION(ft_strlen("bon")); TEST_ASM_FUNCTION(ft_strlen("bonjour")); - TEST_ASM_FUNCTION(ft_strlen("%c%s%p%x%X%e%f%g")); + TEST_ASM_FUNCTION(ft_strlen("asdfasdf''///##!!@")); TEST_ASM_FUNCTION(ft_strlen("the\0hidden")); TEST_ASM_FUNCTION(ft_strlen("Lorem ipsum dolor sit amet, consectetur adipiscing\ elit. Sed in malesuada purus. Etiam a scelerisque massa. Ut non euismod elit. Aliquam\ @@ -29,15 +42,13 @@ ac tortor et lectus fermentum lobortis eu at mauris. Vestibulum sit amet posuere tortor, sit amet consequat amet.")); } -#define FT_STRLEN_EXPECT(str) expect_int(strlen(str), ft_strlen(str)) - static void ft_strlen_test_compare(void) { FT_STRLEN_EXPECT(""); FT_STRLEN_EXPECT("bon"); FT_STRLEN_EXPECT("bonjour"); - FT_STRLEN_EXPECT("%c%s%p%x%X%e%f%g"); + FT_STRLEN_EXPECT("asdfasdf''///##!!@"); FT_STRLEN_EXPECT("the\0hidden"); FT_STRLEN_EXPECT("Lorem ipsum dolor sit amet, consectetur adipiscing\ elit. Sed in malesuada purus. Etiam a scelerisque massa. Ut non euismod elit. Aliquam\ |
