diff options
Diffstat (limited to 'test/src/mem/test_ft_calloc.c')
| -rw-r--r-- | test/src/mem/test_ft_calloc.c | 17 |
1 files changed, 17 insertions, 0 deletions
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]); } |
