aboutsummaryrefslogtreecommitdiffstats
path: root/tests/liballoc_tests.c
diff options
context:
space:
mode:
authorDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 18:29:20 -0500
committerDouglas B. Rumbaugh <doug@douglasrumbaugh.com>2025-11-02 18:29:20 -0500
commit11521b99661f969ba7adad9d2366108a1a001ab0 (patch)
tree5a8d1225cfd9a4b58a5277d6d7f1f5112a7cf020 /tests/liballoc_tests.c
parentf88198cb987ab006f3406698fec410ff1de05534 (diff)
downloadliballoc-11521b99661f969ba7adad9d2366108a1a001ab0.tar.gz
Defined allocator behavior for 0 byte requests
Diffstat (limited to 'tests/liballoc_tests.c')
-rw-r--r--tests/liballoc_tests.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/liballoc_tests.c b/tests/liballoc_tests.c
index 16d50d6..a54998a 100644
--- a/tests/liballoc_tests.c
+++ b/tests/liballoc_tests.c
@@ -26,6 +26,10 @@ START_TEST(basic_allocate) {
size_t alignment = (size_t)memory % ALIGNMENT;
ck_assert_int_eq(alignment, 0);
+ /* allocating 0 size should return NULL */
+ void *memory2 = allocate(0);
+ ck_assert_ptr_eq(memory2, NULL);
+
/* leak the memory--we aren't testing release */
}
END_TEST