From 7d626e7e9638d7e85c3dacce8a4aee009850a1a2 Mon Sep 17 00:00:00 2001 From: Charles Date: Thu, 13 Feb 2020 21:05:15 +0100 Subject: Filled mem* tests --- test/src/mem/test_ft_calloc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/src/mem/test_ft_calloc.c') diff --git a/test/src/mem/test_ft_calloc.c b/test/src/mem/test_ft_calloc.c index 1497728..9944f41 100644 --- a/test/src/mem/test_ft_calloc.c +++ b/test/src/mem/test_ft_calloc.c @@ -10,5 +10,22 @@ TEST_TEAR_DOWN(ft_calloc) TEST(ft_calloc, basic) { + char *ptr = NULL; + ptr = ft_calloc(45, sizeof(char)); + TEST_ASSERT_NOT_NULL(ptr); +#ifdef __APPLE__ + TEST_ASSERT_GREATER_THAN(45 * sizeof(char) - 1, malloc_size(ptr)); +#endif + for (int i = 0; i < 45; i++) + TEST_ASSERT_EQUAL(0x0, ptr[i]); + + int *ptrint = NULL; + ptrint = ft_calloc(10, sizeof(int)); + TEST_ASSERT_NOT_NULL(ptr); +#ifdef __APPLE__ + TEST_ASSERT_GREATER_THAN(10 * sizeof(int) - 1, malloc_size(ptrint)); +#endif + for (int i = 0; i < 10; i++) + TEST_ASSERT_EQUAL(0x0, ptrint[i]); } -- cgit