From 579a26f5593039ffbbd1a81e45ecf0ef8797cb5d Mon Sep 17 00:00:00 2001 From: nass1pro Date: Tue, 9 Jun 2020 19:48:34 +0200 Subject: add lexer add single quote --- test_mini/libft/test/src/mem/test_ft_memccpy.c | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 test_mini/libft/test/src/mem/test_ft_memccpy.c (limited to 'test_mini/libft/test/src/mem/test_ft_memccpy.c') diff --git a/test_mini/libft/test/src/mem/test_ft_memccpy.c b/test_mini/libft/test/src/mem/test_ft_memccpy.c new file mode 100644 index 0000000..39925a1 --- /dev/null +++ b/test_mini/libft/test/src/mem/test_ft_memccpy.c @@ -0,0 +1,45 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* test_ft_memccpy.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/13 03:34:13 by cacharle #+# #+# */ +/* Updated: 2020/02/13 19:35:17 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "libft_test.h" + +TEST_GROUP(ft_memccpy); + +TEST_SETUP(ft_memccpy) +{} + +TEST_TEAR_DOWN(ft_memccpy) +{} + +TEST(ft_memccpy, basic) +{ + char buf[32] = "bonjour"; + char buf2[32] = {0}; + + char *ptr = ft_memccpy(buf2, buf, 0x0, 32); + TEST_ASSERT_EQUAL_PTR(&buf2[8], ptr); + for (int i = 0; i < 32; i++) + TEST_ASSERT_EQUAL_CHAR(buf[i], buf2[i]); + + ptr = ft_memccpy(buf2, buf, 0x1, 32); + TEST_ASSERT_NULL(ptr); + for (int i = 0; i < 32; i++) + TEST_ASSERT_EQUAL_CHAR(buf[i], buf2[i]); + + char buf3[10] = "aurevoir"; + ptr = ft_memccpy(buf, buf3, 'e', 10); + TEST_ASSERT_EQUAL_PTR(buf + 4, ptr); + for (int i = 0; i < 4; i++) + TEST_ASSERT_EQUAL_CHAR(buf[i], buf3[i]); + for (int i = 4; i < 32; i++) + TEST_ASSERT_EQUAL_CHAR(buf[i], buf2[i]); +} -- cgit