diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-06-09 19:48:34 +0200 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-06-13 11:31:00 +0200 |
| commit | 579a26f5593039ffbbd1a81e45ecf0ef8797cb5d (patch) | |
| tree | c5b6761db98e27d15bab3fb45ba9e0a646cf06e0 /test_mini/libft/test/src/mem/test_ft_memccpy.c | |
| parent | 9fabc25a980550afc6337fd729632462f2680daa (diff) | |
| download | minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.tar.gz minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.tar.bz2 minishell-579a26f5593039ffbbd1a81e45ecf0ef8797cb5d.zip | |
add lexer
add single quote
Diffstat (limited to 'test_mini/libft/test/src/mem/test_ft_memccpy.c')
| -rw-r--r-- | test_mini/libft/test/src/mem/test_ft_memccpy.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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]); +} |
