add test for zero-sized alloc and aligned alloc

This commit is contained in:
Dave Watson
2018-10-09 08:41:36 -07:00
parent 01e2a38e5a
commit 2b112ea593
3 changed files with 28 additions and 1 deletions

View File

@@ -138,10 +138,20 @@ TEST_BEGIN(test_alignment_and_size) {
}
TEST_END
TEST_BEGIN(test_zero_alloc) {
void *res = aligned_alloc(8, 0);
assert(res);
size_t usable = malloc_usable_size(res);
assert(usable > 0);
free(res);
}
TEST_END
int
main(void) {
return test(
test_alignment_errors,
test_oom_errors,
test_alignment_and_size);
test_alignment_and_size,
test_zero_alloc);
}