diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-13 21:05:15 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-13 21:08:23 +0100 |
| commit | 7d626e7e9638d7e85c3dacce8a4aee009850a1a2 (patch) | |
| tree | dd62ec180cc4b3d304ed83c4881ca71615106881 /test/src/mem/test_ft_calloc.c | |
| parent | 2d1fcee4db6a9411b6f7db2c36791f67472109dc (diff) | |
| download | libft-7d626e7e9638d7e85c3dacce8a4aee009850a1a2.tar.gz libft-7d626e7e9638d7e85c3dacce8a4aee009850a1a2.tar.bz2 libft-7d626e7e9638d7e85c3dacce8a4aee009850a1a2.zip | |
Filled mem* tests
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]); } |
